spectral:asyncapi warn on by default

asyncapi-channel-no-query-nor-fragment

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

Applies to
channels
Selects
$.channels
Function
pattern
Specs
AsyncAPI 2.x

Use it

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

extends: spectral:asyncapi
rules:
  asyncapi-channel-no-query-nor-fragment: warn   # or off, or another severity

Definition

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

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

About this rule

Query parameters and fragments shouldn’t be used in channel names. Instead, use bindings to define them.

Sources