The operationId of a step must resolve to an operation in a source description.
| Arazzo | Compatibility |
|---|---|
| 1.x | ✅ |
The Arazzo specification defines the operationId of a step as the name of an existing, resolvable operation in one of the sourceDescriptions. A step that names an operation that does not exist cannot be executed. A typo in the operationId, or an operation renamed in the API description, otherwise stays unnoticed until the workflow runs.
The spec-step-operationId-resolved rule loads each source description with the openapi type and reads the operationId of the operations under its paths. It reports a step when:
- The
operationIdis not defined in any of the source descriptions. - The
operationIdis defined in more than one source description. Use the$sourceDescriptions.<name>.<operationId>form to pick one. - The
operationIduses the$sourceDescriptions.<name>.<operationId>form, and the source description<name>does not define the operation. - The
operationIduses the$sourceDescriptions.<name>.<operationId>form, and<name>is not in thesourceDescriptionslist.
The rule also accepts the <name>.<operationId> short form that Respect supports in addition to the specification.
The rule does not report a step when it cannot read the operations it has to check:
- A source description file that cannot be loaded.
- A source description with the
asyncapitype.
| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default: error (in recommended configuration). |
An example configuration:
rules:
spec-step-operationId-resolved: error
Given the following configuration:
rules:
spec-step-operationId-resolved: error
And a cafe.yaml OpenAPI description that defines the listMenuItems operation.
Example of an incorrect step that names an operation the source description does not define:
sourceDescriptions:
- name: cafe-api
type: openapi
url: cafe.yaml
workflows:
- workflowId: place-order
steps:
- stepId: list-menu-items
operationId: listMenu
Example of correct steps:
sourceDescriptions:
- name: cafe-api
type: openapi
url: cafe.yaml
workflows:
- workflowId: place-order
steps:
- stepId: list-menu-items
operationId: listMenuItems
- stepId: list-menu-items-again
operationId: $sourceDescriptions.cafe-api.listMenuItems