parser-js icon indicating copy to clipboard operation
parser-js copied to clipboard

Throw meaningfull error when parser of specific schemaFormat is not available

Open derberg opened this issue 5 years ago • 13 comments

Describe the bug

We do not check if there is a parser available for a given custom schemaFormat and throw not meaningful error that PARSERS[String(...)] is not a function

Hint: this is where we trigger parsers and we need to validate if the function is really there -> https://github.com/asyncapi/parser-js/blob/master/lib/parser.js#L179

How to Reproduce

Just try to parse the spec with payload defined with some openapi/raml/avro schema. Without registering schema parsers for those schema formats.

Expected behavior

In my opinion we need to add new error type and document it in the readme too https://github.com/asyncapi/parser-js#error-types

How about: schema-parser-not-registered? with detail property that indicates exactly what message has this problem? and of course exact location of the error in the file.

Bonus would be to have an idea how to tell the user that for some schemas there are parsers, and where they can find them

derberg avatar Aug 10 '20 12:08 derberg

video about the issue https://youtu.be/Iqs_2BiNEEo?t=1857

derberg avatar Oct 01 '20 07:10 derberg

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Dec 01 '20 00:12 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Jan 31 '21 00:01 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Jun 01 '21 02:06 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Aug 01 '21 00:08 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Oct 01 '21 00:10 github-actions[bot]

Hi @derberg I would like to work on this issue

ritik307 avatar Jan 16 '22 12:01 ritik307

@ritik307 go ahead man, make sure to look into previous PR, there was already a lot of work done that you can reuse afaik

derberg avatar Jan 17 '22 08:01 derberg

@ritik307 go ahead man, make sure to look into previous PR, there was already a lot of work done that you can reuse afaik

Sure will look into them 😁

ritik307 avatar Jan 17 '22 09:01 ritik307

@derberg I am facing an error in lib/parser.js while setting up the project to the point where the last PR was made. I have added everything that was done in the last PR. While testing the code after completing the changes I face the following issue:-

ss1

I replaced it with the defaultSchemaFormat function and all my test cases passed.

ss1

So is it the correct way to resolve the error or am I doing something wrong here?

ritik307 avatar Jan 18 '22 14:01 ritik307

@ritik307 please open up a Draft PR as it will be much easier to see all the changes that you did and ineract there on specifics 🙏🏼

derberg avatar Jan 18 '22 14:01 derberg

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

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 :heart:

github-actions[bot] avatar May 19 '22 00:05 github-actions[bot]

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

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 :heart:

github-actions[bot] avatar Sep 17 '22 00:09 github-actions[bot]

Issue is resolved in v2 ParserJS - now in https://github.com/asyncapi/parser-js/tree/next-major branch in https://github.com/asyncapi/parser-js/blob/next-major/src/schema-parser/index.ts#L34 line - but we probably need to wait for PR for v1 ParserJS https://github.com/asyncapi/parser-js/pull/449

What do you think, should we close it or should we wait for https://github.com/asyncapi/parser-js/pull/449 PR?

cc @derberg @ritik307

magicmatatjahu avatar Oct 25 '22 09:10 magicmatatjahu

up to @ritik307 if he can continue. Otherwise close I guess

derberg avatar Oct 25 '22 09:10 derberg

Ok @ritik307 I will wait max 2 weeks for your response and in the case without response I will close this one.

magicmatatjahu avatar Oct 28 '22 12:10 magicmatatjahu

I am closing due to lack of response.

magicmatatjahu avatar Nov 15 '22 07:11 magicmatatjahu