Asyncapi Tags Uniqueness

asyncapi-tags-uniqueness · built-in

info experience: consistencyexperience: discoverability spec: serversspec: channelsspec: messagesspec: components

{{error}}

Each tag must have a unique name.

Rule definition

The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.

asyncapi-tags-uniqueness:
  title: Asyncapi Tags Uniqueness
  reference: https://spotlight-rules.com/spec/rules/asyncapi/asyncapi-tags-uniqueness/
  description: Each tag must have a unique name.
  message: "{{error}}"
  severity: info
  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
  tags:
    - format:asyncapi
    - spec:servers
    - spec:channels
    - spec:messages
    - spec:components
    - experience:consistency
    - experience:discoverability
  prompt: "You are editing an AsyncAPI document to satisfy the Spotlight API
    governance rule 'asyncapi-tags-uniqueness' (Asyncapi Tags Uniqueness).
    Requirement: Each tag must have a unique name. This rule is evaluated at the
    JSONPath `$.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` —
    inspect every location it matches and correct only what violates the rule.
    Make the smallest change that satisfies the rule, leave all unrelated
    content, key order, comments, and formatting unchanged, and keep the
    document valid AsyncAPI. Return only the complete corrected document, with
    no commentary."
AI fix prompt — send this to Claude, Gemini, or ChatGPT with your artifact to auto-fix this rule
You are editing an AsyncAPI document to satisfy the Spotlight API governance rule 'asyncapi-tags-uniqueness' (Asyncapi Tags Uniqueness). Requirement: Each tag must have a unique name. This rule is evaluated at the JSONPath `$.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` — inspect every location it matches and correct only what violates the rule. Make the smallest change that satisfies the rule, leave all unrelated content, key order, comments, and formatting unchanged, and keep the document valid AsyncAPI. Return only the complete corrected document, with no commentary.
ArtifactAsyncAPI
Applies at (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
Severityinfo — educational by default; raise to warn/error to enforce
Referencehttps://spotlight-rules.com/spec/rules/asyncapi/asyncapi-tags-uniqueness/