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

Integrate the extension catalog with the JS parser #803

Open
sambhavgupta0705 opened this issue Jul 18, 2023 · 14 comments
Open

Integrate the extension catalog with the JS parser #803

sambhavgupta0705 opened this issue Jul 18, 2023 · 14 comments
Labels
enhancement New feature or request

Comments

@sambhavgupta0705
Copy link
Member

In regards of Mentorship issue Extension Catalog we need to validate the extension with parser-js,regarding I would like to know in which folder should I place the models of the extension.

@sambhavgupta0705 sambhavgupta0705 added the enhancement New feature or request label Jul 18, 2023
@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@derberg
Copy link
Member

derberg commented Jul 25, 2023

@smoya @magicmatatjahu @jonaslagoni

folks do you have an opinion what would be the best place for such to place? It would be also similar with bindings.

what I guess is that that we need a clear idea:

  • where to place models for extensions
  • where to place validation code for extensions using spectral

@jonaslagoni
Copy link
Member

jonaslagoni commented Nov 7, 2023

folks do you have an opinion what would be the best place for such to place? It would be also similar with bindings.
I have no idea.

Not really no, cause we still need to enable custom extensions and bindings, which means we can't really force types in any way 🤨

I would look into the different solutions and propose them so we can see what's possible. Without deep diving into it, Its a shot in the dark 🤷

Copy link
Member

derberg commented Nov 7, 2023

enable custom extensions and bindings, which means we can't really force types in any way 🤨

sorry, what do you mean?
also, I guess by custom extensions you mean the same as extension catalog but "private", but extension catalog is easier, as these are official extensions, do not require fancy solution with some custom extensions packages (like custom schema parsers). So MVP idea with extension catalog is to treat it as part of parser - as extensions from extension catalog are official extensions

@smoya
Copy link
Member

smoya commented Nov 7, 2023

Current Parser-API does not support any model for any extension or bindings.
If we want to support them via the API of the parser, we need to first work on the Parser-API repository and get into an agreement there.

The alternative would be to keep it like it is today but crafting some sort of external parser for those extensions (maybe in the extensions-catalog repo. For example, a signature like function TwitterExtension(document: AsyncAPIDocument): TwitterExtensionModel so in that way it is not coupled with the parser.

I think both solutions have pros and cons that should be evaluated though.

@sambhavgupta0705
Copy link
Member Author

sambhavgupta0705 commented Dec 8, 2023

Current Parser-API does not support any model for any extension or bindings.
If we want to support them via the API of the parser, we need to first work on the Parser-API repository and get into an agreement there.

The alternative would be to keep it like it is today but crafting some sort of external parser for those extensions (maybe in the extensions-catalog repo. For example, a signature like function TwitterExtension(document: AsyncAPIDocument): TwitterExtensionModel so in that way it is not coupled with the parser.

@derberg which method seems good to you ?

Copy link
Member

derberg commented Dec 19, 2023

both are complex enough @sambhavgupta0705 so that we need to figure out what next, as it might be to much for mentorship

@sambhavgupta0705
Copy link
Member Author

okay @derberg
atm I don't have that much idea of parser so can't say anything about this

@smoya
Copy link
Member

smoya commented Dec 21, 2023

okay @derberg atm I don't have that much idea of parser so can't say anything about this

I'm open to answer all your questions as I did through Slack via DM (Still waiting for your feedback btw).
I encourage you to keep into the loop; I'm happy to guide you.

For the record:

Sergio Moya
:v3:  [13:24](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988683762959)
The JSON Schema documents are for validating purpose. They validate basic structure of the AsyncAPI document.
[13:25](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988728341559)
The Parser-JS parses the AsyncAPI documents. That includes first a validation of them using those JSON Schema files, among other checks the Parser. performs
[13:25](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988758569939)
Once validated, it gives you a Javascript object that represents the parsed document, where you can access all the objects of an AsyncAPI document, such as Channels, Operations, etc.
[13:26](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988770037739)
For example, document.channels()
[13:28](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988882340369)
The current Parser-JS API follows the [Parser-API](https://github.com/asyncapi/parser-api/blob/master/docs/api.md), which is just a plain text document that defines which API the parser should expose to their users. For instance, document.channels()  is documented in the Parser-API [here](https://github.com/asyncapi/parser-api/blob/master/docs/api.md#asyncapidocument) as channels(): Channels
[13:28](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988918759979)
Meaning, that method should return a Channels object, which is also documented in the Parser-API: https://github.com/asyncapi/parser-api/blob/master/docs/api.md#channels
[13:28](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988922954919)
Etc
[13:29](https://asyncapi.slack.com/archives/D057P2Q6N03/p1702988972375209)
Now, if you want to introduce a change in the schema, like a new object and you want the users to be able to access that, you will need to expose it through the Parser-API and then implement it in the Parser-JS.

@sambhavgupta0705
Copy link
Member Author

yes @smoya
Thanks for answering all my questions 😄

Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Apr 22, 2024
@sambhavgupta0705
Copy link
Member Author

still relevant

@github-actions github-actions bot removed the stale label Apr 23, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Aug 21, 2024
@sambhavgupta0705
Copy link
Member Author

Still relevant

@github-actions github-actions bot removed the stale label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants