channel-address-no-query

Since 0.12.0 · In the rulesets: Recommended at error, Strict at error, All at error

This rule checks that no channel address contains a query (?) or a fragment (#).

Rule details

The specification says that a channel address shall not use query parameters or fragments, and puts them in the channel’s bindings instead. The rule reports Channel address must not contain a query ('?') or a fragment ('#') on every channel, under channels and components/channels, whose address holds a ? or a #.

The rule is the counterpart of the AsyncAPI parser’s asyncapi3-channel-no-query-nor-fragment, which checks the channel’s key rather than its address.

Turn the rule off only for a broker whose destination names contain a ? or a #: the specification does not allow them in an address.

Examples

Good.

asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
channels:
  petAdopted:
    address: pets/{kind}/adopted
    parameters:
      kind: {}

Bad. The kind of pet is a query.

asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
channels:
  petAdopted:
    address: pets/adopted?kind=cat

Turn it off or change its severity

In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.asyncapi has the details.

commands:
  lint:
    asyncapi:
      rules:
        channel-address-no-query: off

Related rules

Further reading

Was this helpful?