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

New interface for custom schema parser #480

Closed
Tracked by #481
magicmatatjahu opened this issue Mar 3, 2022 · 3 comments
Closed
Tracked by #481

New interface for custom schema parser #480

magicmatatjahu opened this issue Mar 3, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@magicmatatjahu
Copy link
Member

magicmatatjahu commented Mar 3, 2022

It will introduce breaking change so this should be done when rewriting the parser to the IntentAPI and TS

Reason/Context

Currently, custom parsers for the massage's payload (and in the 3.0.0 AsyncAPI version this will be made available to all schemas) have two methods: parse(), which parses the given format into an AsyncAPI JSON Schema, which is later used in ModelAPI (in 2.0.0 version of lib it will be IntentAPI), and getMimeTypes() which returns the mime types that specify the given schema format. We are missing 3 functions validate, which would return possible errors if a given schema has syntax errors.

Description

We should update all custom schema parsers to have that third function and it should be mandatory.

Due to the fact that RAML/OpenAPISchema/AVRO can be described using YAML or JSON we can easily validate them using JSON Schema and AJV and then combine the validation with Spectral from Stoplight (see more #477).

cc @jonaslagoni @smoya

@magicmatatjahu magicmatatjahu added the enhancement New feature or request label Mar 3, 2022
@magicmatatjahu magicmatatjahu mentioned this issue Mar 3, 2022
20 tasks
@magicmatatjahu
Copy link
Member Author

I wonder if there should be also a method that would validate the example based on the schema (use case asyncapi/studio#200). We can of course convert the format to AsyncAPI JSON Schema and validate on that, but I wonder if it would make sense. It should be discussed.

@smoya
Copy link
Member

smoya commented Jun 27, 2022

@magicmatatjahu I would love to work on this issue so I can get more knowledge on how Stoplight integrates with the Parser. It would need, however, to happen next week. Hope you are ok with that @magicmatatjahu 🙏

@magicmatatjahu
Copy link
Member Author

Issue is resolved in v2 ParserJS - now in https://github.com/asyncapi/parser-js/tree/next-major branch

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

2 participants