-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Report parse failure reasons #1051
Labels
Comments
@michael-ball-ctct lgtm, please feel free to open a PR 🙏🏼 |
michael-ball-ctct
added a commit
to michael-ball-ctct/asyncapi-source-generator
that referenced
this issue
Oct 30, 2023
For [](asyncapi#1051) I opted for the more basic logging style - I don't know enough about the diagnostics objects to be sure that they'll always contain the same fields, so erred on the side of caution rather than trying to access fields within fields that aren't guaranteed to exist (as well as including all available information, regardless of what is provided).
michael-ball-ctct
added a commit
to michael-ball-ctct/asyncapi-source-generator
that referenced
this issue
Oct 30, 2023
For [](asyncapi#1051) I opted for the more basic logging style - I don't know enough about the diagnostics objects to be sure that they'll always contain the same fields, so erred on the side of caution rather than trying to access fields within fields that aren't guaranteed to exist (as well as including all available information, regardless of what is provided).
🎉 This issue has been resolved in version 1.16.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reason/Context
This is a general Quality of Life improvement for anyone using the generator. By implementing this, the speed at which someone trying to process AsyncAPI docs can diagnose and understand the issues with their document formatting will significantly increase.
Description
The changes for this are fairly simple. In
lib/generator.js - Generator.parseInput()
block where the document is reported as "not correct" (currently at https://github.com/asyncapi/generator/blob/master/lib/generator.js#L353 ), before the error thediagnostics
from the error response can be looped over toconsole.error
out each of the issues found before the error is thrown. Something like:This would result in an error log being emitted before the thrown error ("Error: Input is not a correct AsyncAPI document so it cannot be processed.") such as:
Obviously, the exact phrasing of the error is less important than the information.
console.error("Diagnostic err:", diag);
would still be a huge improvement here (and I guess also be less brittle, as it doesn't rely so heavily on the structure of the diagnostic objects that get returns being consistent...)Thanks in advance for any consideration of this. I'm happy to make a PR for this if you want - just let me know which logging strategy is preferred.
The text was updated successfully, but these errors were encountered: