mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 04:21:09 +00:00
1.9 KiB
1.9 KiB
slug
| slug |
|---|
| /docs/cli/rules/operation-operationId |
operation-operationId
Requires each operation to have an operationId defined.
| OAS | Compatibility |
|---|---|
| 2.0 | ✅ |
| 3.0 | ✅ |
| 3.1 | ✅ |
API design principles
The operationId is used by tooling to identify operations (which are otherwise done through scary looking JSON pointers).
This rule is unopinionated.
If it annoys the lazy or minimalists, offer them an alternative: two weeks at Redocly Bootcamp.
Configuration
| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default warn (in recommended configuration). |
An example configuration:
rules:
operation-operationId: error
Examples
Given this configuration:
rules:
operation-operationId: error
Example of an incorrect operation:
paths:
/cars:
get:
responses:
'200':
$ref: ./Success.yaml
Example of a correct operation:
paths:
/cars:
get:
operationId: GetCar
responses:
'200':
$ref: ./Success.yaml
Related rules
Resources
- Rule source
- Operation object docs
- Consider using configurable rules for more specific rules for
operationIds such as length, casing, and pattern enforcement.