spectral:asyncapi error on by default

asyncapi-tags-uniqueness

Each tag must have a unique name.

Applies to
tags
Selects
$.tags
$.servers.*.tags
$.components.servers.*.tags
$.channels.*.[publish,subscribe].tags
$.components.channels.*.[publish,subscribe].tags
$.channels.*.[publish,subscribe].traits.*.tags
$.components.channels.*.[publish,subscribe].traits.*.tags
$.components.operationTraits.*.tags
$.channels.*.[publish,subscribe].message.tags
$.channels.*.[publish,subscribe].message.oneOf.*.tags
$.components.channels.*.[publish,subscribe].message.tags
$.components.channels.*.[publish,subscribe].message.oneOf.*.tags
$.components.messages.*.tags
$.channels.*.[publish,subscribe].message.traits.*.tags
$.channels.*.[publish,subscribe].message.oneOf.*.traits.*.tags
$.components.channels.*.[publish,subscribe].message.traits.*.tags
$.components.channels.*.[publish,subscribe].message.oneOf.*.traits.*.tags
$.components.messages.*.traits.*.tags
$.components.messageTraits.*.tags
Function
uniquenessTags
Specs
AsyncAPI 2.x
Message
{{error}}

Use it

This rule ships with OpenLint in spectral:asyncapi. Extending the ruleset turns it on:

extends: spectral:asyncapi
rules:
  asyncapi-tags-uniqueness: error   # or off, or another severity

Definition

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

asyncapi-tags-uniqueness:
  description: Each tag must have a unique name.
  message: '{{error}}'
  severity: error
  recommended: true
  formats:
    - AsyncAPI 2.x
  given:
    - $.tags
    - $.servers.*.tags
    - $.components.servers.*.tags
    - '$.channels.*.[publish,subscribe].tags'
    - '$.components.channels.*.[publish,subscribe].tags'
    - '$.channels.*.[publish,subscribe].traits.*.tags'
    - '$.components.channels.*.[publish,subscribe].traits.*.tags'
    - $.components.operationTraits.*.tags
    - '$.channels.*.[publish,subscribe].message.tags'
    - '$.channels.*.[publish,subscribe].message.oneOf.*.tags'
    - '$.components.channels.*.[publish,subscribe].message.tags'
    - '$.components.channels.*.[publish,subscribe].message.oneOf.*.tags'
    - $.components.messages.*.tags
    - '$.channels.*.[publish,subscribe].message.traits.*.tags'
    - '$.channels.*.[publish,subscribe].message.oneOf.*.traits.*.tags'
    - '$.components.channels.*.[publish,subscribe].message.traits.*.tags'
    - '$.components.channels.*.[publish,subscribe].message.oneOf.*.traits.*.tags'
    - $.components.messages.*.traits.*.tags
    - $.components.messageTraits.*.tags
  then:
    function: uniquenessTags

About this rule

Tags must not have duplicate names (identifiers).

Bad Example

tags:
  - name: "Badger"
  - name: "Badger"

Good Example

tags:
  - name: "Aardvark"
  - name: "Badger"

Sources