operation-tags-defined

Since 0.9.0 · In the rulesets: Recommended at warning, Strict at warning, All at error

This rule checks whether every operation of an AsyncAPI document has at least one tag assigned.

Rule details

Tags group related operations. Documentation generators use them to organize operations into sections, and consumers use them to find the operations they are interested in.

The operation-tags-defined rule reports Operation has no tags defined for every operation (in the root operations map and in components/operations) whose own tags list is missing or empty. Tags coming from operation traits are not taken into account.

Turn the rule off for small APIs, whose operations do not need to be grouped.

Examples

Good.

asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
channels:
  petAdopted:
    address: pets.adopted
operations:
  onPetAdopted:
    action: receive
    channel:
      $ref: "#/channels/petAdopted"
    tags:
      - name: adoption

Bad.

asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
channels:
  petAdopted:
    address: pets.adopted
operations:
  onPetAdopted:
    action: receive
    channel:
      $ref: "#/channels/petAdopted"

Turn it off or change its severity

In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.asyncapi has the details.

commands:
  lint:
    asyncapi:
      rules:
        operation-tags-defined: off

Related rules

Was this helpful?