asyncapi-3-channel-no-trailing-slash
Channel address must not end with slash.
- 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-trailing-slash: warn # or off, or another severity
Definition
As defined in @openlint/openlint-rulesets. Functions show by name.
asyncapi-3-channel-no-trailing-slash:
description: Channel address must not end with slash.
recommended: true
formats:
- AsyncAPI 3.x
given: $.channels.*
then:
field: address
function: pattern
functionOptions:
notMatch: .+\/$
About this rule
Keep trailing slashes off of channel address, as it can cause some confusion. Most messaging protocols will treat example/foo and example/foo/ as different things. Keep in mind that tooling may replace slashes (/) with protocol-specific notation (e.g.: . for AMQP), therefore, a trailing slash may result in an invalid channel address in some protocols.