Asyncapi Payload
asyncapi-payload · built-in
info
experience: data-modelingexperience: reliability
spec: channelsspec: messagesspec: componentsspec: schemas
{{error}}
Payloads must be valid against AsyncAPI Schema object.
Rule definition
The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.
asyncapi-payload:
title: Asyncapi Payload
reference: https://spotlight-rules.com/spec/rules/asyncapi/asyncapi-payload/
description: Payloads must be valid against AsyncAPI Schema object.
message: "{{error}}"
severity: info
given:
- $.components.messageTraits[?(@.schemaFormat === void 0)].payload
- $.components.messages[?(@.schemaFormat === void 0)].payload
- $.channels[*][publish,subscribe][?(@property === 'message' &&
@.schemaFormat === void 0)].payload
then:
function: asyncApiPayloadValidation
tags:
- format:asyncapi
- spec:channels
- spec:messages
- spec:components
- spec:schemas
- experience:data-modeling
- experience:reliability
prompt: "You are editing an AsyncAPI document to satisfy the Spotlight API
governance rule 'asyncapi-payload' (Asyncapi Payload). Requirement: Payloads
must be valid against AsyncAPI Schema object. This rule is evaluated at the
JSONPath `$.components.messageTraits[?(@.schemaFormat === void 0)].payload |
$.components.messages[?(@.schemaFormat === void 0)].payload |
$.channels[*][publish,subscribe][?(@property === 'message' && @.schemaFormat
=== void 0)].payload` — 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-payload' (Asyncapi Payload). Requirement: Payloads must be valid against AsyncAPI Schema object. This rule is evaluated at the JSONPath `$.components.messageTraits[?(@.schemaFormat === void 0)].payload | $.components.messages[?(@.schemaFormat === void 0)].payload | $.channels[*][publish,subscribe][?(@property === 'message' && @.schemaFormat === void 0)].payload` — 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.
| Artifact | AsyncAPI |
|---|---|
| Applies at (given) | $.components.messageTraits[?(@.schemaFormat === void 0)].payload | $.components.messages[?(@.schemaFormat === void 0)].payload | $.channels[*][publish,subscribe][?(@property === 'message' && @.schemaFormat === void 0)].payload |
| Severity | info — educational by default; raise to warn/error to enforce |
| Reference | https://spotlight-rules.com/spec/rules/asyncapi/asyncapi-payload/ |