asyncapi-operation-operationId-uniqueness
"operationId" must be unique across all the operations.
- Applies to
operationId- Selects
$- Function
asyncApi2OperationIdUniqueness- Specs
- AsyncAPI 2.x
Use it
This rule ships with OpenLint in spectral:asyncapi. Extending the ruleset turns it on:
extends: spectral:asyncapi
rules:
asyncapi-operation-operationId-uniqueness: error # or off, or another severity
Definition
As defined in @openlint/openlint-rulesets. Functions show by name.
asyncapi-operation-operationId-uniqueness:
description: '"operationId" must be unique across all the operations.'
severity: error
recommended: true
formats:
- AsyncAPI 2.x
given: $
then:
function: asyncApi2OperationIdUniqueness
About this rule
operationId must be unique across all the operations (except the ones defined in the components).
Bad Example
channels:
smartylighting.streetlights.1.0.action.{streetlightId}.turn.on:
publish:
operationId: turn
smartylighting.streetlights.1.0.action.{streetlightId}.turn.off:
publish:
operationId: turn
Good Example
channels:
smartylighting.streetlights.1.0.action.{streetlightId}.turn.on:
publish:
operationId: turnOn
smartylighting.streetlights.1.0.action.{streetlightId}.turn.off:
publish:
operationId: turnOff