This rule checks each operation defined in an OpenAPI schema and warns if operation IDs are missing or empty.
Assigning operation a unique identifier helps with managing them. Identifiers can also be used by code generators to produce implementation of API calls.
The operation-id-defined
rule is designed to ensure that each operation
in an OpenAPI schema has non-empty operation ID.
None.
Good. The following operation has a descriptive name that makes it easy to use the operation properly.
paths:
/users:
get:
operationId: readUserList
responses:
"200":
description: Returns a list of users.
Bad. The following operation does not have a name. It is not entirely clear
what it does. Using e.g. cancelReservation
would help with it.
paths:
/reservations:
delete:
responses: ...
We recommend to always enable this rule.
This rule is compatible with all OpenAPI 3.x versions.