Asyncapi 3 Headers Schema Type Object

asyncapi-3-headers-schema-type-object · built-in

info experience: data-modelingexperience: reliability spec: channelsspec: messagesspec: components

Headers schema type must be "object" ({{error}}).

Headers schema type must be “object”.

Rule definition

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

asyncapi-3-headers-schema-type-object:
  title: Asyncapi 3 Headers Schema Type Object
  reference: https://spotlight-rules.com/spec/rules/asyncapi/asyncapi-3-headers-schema-type-object/
  description: Headers schema type must be "object".
  message: Headers schema type must be "object" ({{error}}).
  severity: info
  given:
    - $.components.messageTraits.*.headers
    - $.components.messages.*.headers
    - $.channels.*.messages.*.headers
    - $.channels.*.messages.*.traits[*].headers
  then:
    function: schema
    functionOptions:
      allErrors: true
      schema:
        type: object
        properties:
          type:
            enum:
              - object
        required:
          - type
  tags:
    - format:asyncapi
    - spec:channels
    - spec:messages
    - spec:components
    - experience:data-modeling
    - experience:reliability
  prompt: "You are editing an AsyncAPI document to satisfy the Spotlight API
    governance rule 'asyncapi-3-headers-schema-type-object' (Asyncapi 3 Headers
    Schema Type Object). Requirement: Headers schema type must be \"object\". To
    fix: Adjust the targeted value so it conforms to the schema this rule
    requires. This rule is evaluated at the JSONPath
    `$.components.messageTraits.*.headers | $.components.messages.*.headers |
    $.channels.*.messages.*.headers | $.channels.*.messages.*.traits[*].headers`
    — 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-3-headers-schema-type-object' (Asyncapi 3 Headers Schema Type Object). Requirement: Headers schema type must be "object". To fix: Adjust the targeted value so it conforms to the schema this rule requires. This rule is evaluated at the JSONPath `$.components.messageTraits.*.headers | $.components.messages.*.headers | $.channels.*.messages.*.headers | $.channels.*.messages.*.traits[*].headers` — 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)$.components.messageTraits.*.headers | $.components.messages.*.headers | $.channels.*.messages.*.headers | $.channels.*.messages.*.traits[*].headers
Severityinfo — educational by default; raise to warn/error to enforce
Referencehttps://spotlight-rules.com/spec/rules/asyncapi/asyncapi-3-headers-schema-type-object/