This rule checks whether operations defined in an OpenAPI schema have unique IDs.
Duplicate operation ID make it difficult to reason about their purpose, as well as about.
The operation-id-unique
rule checks IDs of operations defined in an OpenAPI
schema and warn if duplicates found. Empty operation IDs do not count as
duplicates.
None.
Good. It is immediately visible what each operation does.
paths:
/users:
get:
operationId: getUsers
responses:
"200":
description: A list of users.
/users/{id}:
get:
operationId: getUserById
responses:
"200":
description: A single user.
Bad. Two operations have identical IDs, which makes it difficult to decide which one to use in each case.
paths:
/downloads:
patch:
# changes the status to 'cancelled'
operationId: cancelDownload
...
delete:
operationId: cancelDownload
...
We recommend to always enable this rule.
This rule is compatible with all OpenAPI 3.x versions.