spectral:asyncapi error on by default

asyncapi-operation-operationId

Operation must have "operationId".

Applies to
operationId
Selects
$.channels[*][publish,subscribe]
Function
truthy
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: error   # or off, or another severity

Definition

As defined in @openlint/openlint-rulesets. Functions show by name.

asyncapi-operation-operationId:
  description: Operation must have "operationId".
  severity: error
  recommended: true
  formats:
    - AsyncAPI 2.x
  given: '$.channels[*][publish,subscribe]'
  then:
    field: operationId
    function: truthy

About this rule

This operation ID is essentially a reference for the operation. Tools may use it for defining function names, class method names, and even URL hashes in documentation systems.

Sources