Last updated

channels-kebab-case

Channel address should be kebab-case (lowercase with hyphens).

AsyncAPICompatibility
2.6
3.0

API design principles

Using consistent casing for the channel address provides a better developer experience and a more predictable experience overall.

Configuration

OptionTypeDescription
severitystringPossible values: off, warn, error. Default off.

An example configuration:

rules:
  channels-kebab-case: error

Examples

Given the following configuration:

rules:
  channels-kebab-case: error

Example of an incorrect channel:

channels:
  ticketSales:
    address: transactions/ticketSales # channel address value checked by rule
    messages:
      ticketSaleTransaction:
        $ref: '#/components/messages/ticketSaleTransaction'

Example of a correct channel:

channels:
  ticketSales:
    address: transactions/ticket-sales # channel address value checked by rule
    messages:
      ticketSaleTransaction:
        $ref: '#/components/messages/ticketSaleTransaction'

Channel rules for AsyncAPI 2.6

The syntax for how the channels are described changed with the AsyncAPI 3.0 release. This rule also works with AsyncAPI 2.6 and checks the channel address used as the key of the channels object. For example, the rule would catch this example where transactions/ticketSales is used as a channel name:

channels:
  transactions/ticketSales: # channel address value checked by rule
    subscribe:
      message:
        $ref: '#/components/messages/ticketSaleTransaction'

Change the channel name to transactions/ticket-sales to comply with this rule.

Resources