parser-js: Throw meaningfull error when parser of specific schemaFormat is not available
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
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 17 (7 by maintainers)
up to @ritik307 if he can continue. Otherwise close I guess