spectral:asyncapi info on by default

asyncapi-3-payload-unsupported-schemaFormat

Message schema validation is only supported with default unspecified "schemaFormat".

Applies to
schemaFormat
Selects
$.components.messages.*.payload
$.channels.*.messages.*.payload
Function
undefined
Specs
AsyncAPI 3.x

Use it

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

extends: spectral:asyncapi
rules:
  asyncapi-3-payload-unsupported-schemaFormat: info   # or off, or another severity

Definition

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

asyncapi-3-payload-unsupported-schemaFormat:
  description: >-
    Message schema validation is only supported with default unspecified
    "schemaFormat".
  severity: info
  recommended: true
  formats:
    - AsyncAPI 3.x
  given:
    - $.components.messages.*.payload
    - $.channels.*.messages.*.payload
  then:
    field: schemaFormat
    function: undefined

About this rule

AsyncAPI can support various schemaFormat values. When unspecified, one of the following will be assumed:

application/vnd.aai.asyncapi;version=2.0.0 application/vnd.aai.asyncapi+json;version=2.0.0 application/vnd.aai.asyncapi+yaml;version=2.0.0

At this point, explicitly setting schemaFormat is not supported by Spectral, so if you use it this rule will emit an info message and skip validating the payload.

Other formats such as OpenAPI Schema Object, JSON Schema Draft 07, and Avro will be added in various upcoming versions.

Sources