Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inject helper excludeChannel and includeOnlyChannels params don't work with AsyncAPI document #70

Closed
gabormagyar opened this issue Mar 25, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@gabormagyar
Copy link
Contributor

Alternate title:

Injector mapIndex produces empty object for AsyncAPI document

Describe the bug
inject([...]) filter functionality (excludeChannel, includeOnlyChannels) doesn't work, scope unclear.

To Reproduce
I'm using a standard, valid asyncAPI document, I'm not sure if it works for other things.

Expected behavior
excludeChannel, includeOnlyChannels params are respected

Additional context
I'm debugging into Injector.ts, and the offending code seems to be the mapIndex function. With this particular example at least, the problem seems to be that the $ref field is selected twice, once by the Object.values(methods) call, and then a second time by the explicit methodToFileRef.$ref accessor.

You can see in the debugger that Object.values(methods) is already a string array:
Screenshot 2022-03-25 at 13 41 10

The result is that methodToFileRef is a string and methodToFileRef.$ref is undefined.
Screenshot 2022-03-25 at 13 29 53

Therefore nothing ever gets added to this.this.fileToRouteMap so nothing ever passes the filter whitelist or blacklists. They have no entries to filter against.

@gabormagyar gabormagyar added the bug Something isn't working label Mar 25, 2022
@j-d-carmichael
Copy link
Owner

I will take a look into this over the weekend

@j-d-carmichael
Copy link
Owner

j-d-carmichael commented Mar 26, 2022

@gabormagyar after examining this evening, it looks like the inject helper has never been working for async api channels! Thank your for reporting it!

This resolves the issue: https://github.com/j-d-carmichael/boats/blob/2.32.0/src/Injector.ts#L254

And tested here: https://github.com/j-d-carmichael/boats/blob/2.32.0/srcASYNC2/index.yml#L19

@gabormagyar
Copy link
Contributor Author

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants