question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[AsyncAPI] Identify abandoned channels when specifying multiple files

See original GitHub issue

User 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
nulltokencommented, Apr 23, 2020

@jonaslagoni Much clearer! Thanks for the explanation.

This feature would then define both channels as abandoned because C publishes to a channel which nobody subscribes to and A subscribes to a channel nobody publishes to.

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.

0reactions
philsturgeoncommented, Apr 29, 2020

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Reference Rabbit Hole | AsyncAPI Initiative for event ...
Here you can see that we simply reference where the definition of messages and payload schema is located. Schema Object references. As seen...
Read more >
AsyncAPI definition among multiple yaml files - Stack Overflow
The short answer is, by using the Reference Object( $ref ) where possible, so make sure to check the AsyncAPI specification to figure...
Read more >
Model-driven development of asynchronous message-driven ...
Our proposal relies on the AsyncAPI Specification [5] to formalize and ... To achieve this goal, files defining a message-driven API are ...
Read more >
AsyncAPI – Documentation of event- and message-driven ...
Compared to OpenAPI, AsyncAPI is more agnostic in its approach with ... Within the description of the channel we also find the payload....
Read more >
API Reference - Discord.py
You can find more info about the events on the documentation below. ... The private channels that the connected client is participating on....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found