Empty `parserErrors` with `{rejectOnErrors: true}` in certain circumstances
anatoliis opened this issue · comments
Possessions:
raml-js-parser-2
v1.1.48- Two RAML document examples with different combinations of traits: https://github.com/anatoliis/raml-js-parser-2-validation-error-examples
Actions:
Executing parser with rejectOnErrors
parameter set to true
. See example repository above.
Expectations:
A JSON object output or validation error details.
Reality:
Api contains errors.
, but parserErrors
array is empty.
{ Error: Api contains errors.
at toError (/.../raml2html-error-examples/node_modules/raml-1-parser/dist/parser/apiLoader.js:376:17)
at /.../raml2html-error-examples/node_modules/raml-1-parser/dist/parser/apiLoader.js:271:39
parserErrors: [] }
I've prepared two minimal examples in the repository above so you can easily reproduce the case yourself.
IMO it looks like a bug, because first execution of api.errors()
method at raml-1-parser/dist/parser/apiLoader.js:270
returns an error details, but the second one at raml-1-parser/dist/parser/apiLoader.js:377
returns an empty array like there were no errors at all. So the parser ends up in a situation, where there were some validation error, but the details about that error were lost on the way to stdout.
Thanks for you report, @anatoliis !
The fix will appear in the next release.
Regards,
Konstantin Sviridov