[AsyncAPI] Identify abandoned channels when specifying multiple files
See original GitHub issueUser story. As a developer I would like to check all my AsyncAPI documents for wrongfully specified or abandoned channels.
Is your feature request related to a problem? When you have multiple AsyncAPI documents it becomes hard to manually figure out if a channel was wrongfully specified or abandoned.
Describe the solution you’d like Given the following two AsyncAPI documents
...
channels:
smartylighting/streetlights/1/0/event/{streetlightId}/Iighting/measured:
parameters:
streetlightId:
$ref: './components/parameters.yml#/streetlightId'
subscribe:
message:
$ref: './components/messages.yml#/lightMeasured'
...
channels:
smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured:
parameters:
streetlightId:
$ref: './components/parameters.yml#/streetlightId'
publish:
message:
$ref: './components/messages.yml#/lightMeasured'
The 🦅 might see the uppercase ‘i’ in the one channel and lowercase ‘L’ in the other however in different fonts they become one and the same: smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured smartylighting/streetlights/1/0/event/{streetlightId}/Iighting/measured
I would like to see an error or warning saying that those two channels are abandoned.
Additional context Quickly scanned your ruleset documentation but didn’t find any information on how to specify multiple document rulesets, is it supported in Spectral?
Furthermore this multi document rulesets could be applied to matching channels with different parameter types, payloads etc.
Edit Just to clarify further, when using this rulecheck all of one’s AsyncAPI documents would need to be provided for the verification to be complete, so it shouldn’t be a standard ruleset which is always checked. Wouldn’t mind implementing this myself, I just need to figure out how and if multiple document rulesets can be done.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (8 by maintainers)
@jonaslagoni Much clearer! Thanks for the explanation.
That sentence also helped me get a better understanding of the initial request.
It’s not a matter of identifying “orphaned” channels (ie. channels that no one refers to, which would be that complex), but useless associations (channels that are actually referenced but with no usage whatsoever from a functional standpoint).
@philsturgeon That sounds like a great proposal, don’t you think?
@jonaslagoni Could you please come up with a multi document based repro case that would represent the issue to be solved? This would be very helpful for a potential future PR bringing that rule.
Thank you so much for your input everyone! Unfortunately this seems like it’s not going to work in the scope of Spectral for now, but instead is probably better handled by Stoplight Platform when it gets more AsyncAPI support in the core (Explorer in particular).