# channel-address-no-query

Source: https://api-genie.dev/docs/linter/asyncapi/rules/channel-address-no-query

A rule of the AsyncAPI linter, which reads AsyncAPI 3 documents; the reader rejects AsyncAPI 2 documents. 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**.

```yaml
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.

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