Linter rulesAsyncAPIoperation-tags-defined

operation-tags-defined

Since 0.9.0

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.

Configuration

None.

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"

When Not to Use It

You may disable this rule for small APIs, whose operations do not need to be grouped.

Compatibility

This rule is compatible with AsyncAPI 3.x documents. AsyncAPI 2.x documents are rejected by the reader and are not linted.

Related rules