spectral:asyncapi warn on by default

asyncapi-3-channel-no-query-nor-fragment

Channel address must not include query ("?") or fragment ("#") delimiter.

Applies to
address
Selects
$.channels.*
Function
pattern
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-channel-no-query-nor-fragment: warn   # or off, or another severity

Definition

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

asyncapi-3-channel-no-query-nor-fragment:
  description: Channel address must not include query ("?") or fragment ("#") delimiter.
  recommended: true
  formats:
    - AsyncAPI 3.x
  given: $.channels.*
  then:
    field: address
    function: pattern
    functionOptions:
      notMatch: '[\?#]'

About this rule

Query parameters and fragments shouldn’t be used in channel address. Instead, use bindings to define them, ex./given?test is invalid.

Sources