-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Improve error handling in parser #119
Comments
I'm with the idea of introducing more error types! I also think we need to make it super clear what is our approach to validation vs throwing errors. Should we always throw errors and have no warnings? or should we always throw errors and leave it up to the parser users to decide if a particular error type they want to silent or not. Why?
now we are throwing errors that some Parameter or Variable object is not provided. The thing is that it is not mandatory to have those objects. Tck shows parser doesn't work as expected. We might need to maybe introduce some kind of |
We discussed it during an open meeting. We had an agreement that having a kind of |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
This issue has been automatically marked as stale because it has not had recent activity 😴 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 ❤️ |
Hi @magicmatatjahu and @derberg 🙂, this looks like an interesting improvement, but I have some questions.
I think taking inspiration on the HTTP Problems RFC is a good idea, but I'm not sure I'm not aware if this feature is on the CLI or other AsyncAPI tools, but would it make sense to have the parser auto fix these warnings or errors? Kinda like eslint --fix, so the AsyncAPI CLI would call the parser to fix these issues? Maybe not all errors can be fixed automatically, but it would be interesting to know if fixing errors while editing the AsyncAPI document is taking too much time currently and can be improved.
I think it's common for it to be a flag, at least when this If anyone could share their thoughts on this that would be awesome 👍 |
I have to admit this one is pretty old and I don't remember much 😅
I don't think
The flag could be easily added to the
Yup, object it is. My only real concern here is where to draw a line between a spec-related validation and a linter. I'm just not 100% sure if we should go in this direction at all. Maybe we should just remove the validation I added some time ago and it should belong to a separate "linter" solution. Maybe validation in parser should be simple, error only and strict-spec-only. Do you know what I mean? I'm kinda afraid that with one |
About
I had the same thought. I wanna test Spectral from the Stoplight but I don't have time. I wonder if we could reuse the logic related with rulesets and integrate them into our parser, then all the custom logic associated with validating duplicate tags, existing servers in channels etc (things that we cannot validate by JSON Schema) could be implemented using appropriate rules in the linter. Additionally, users would be able to add their own rules. |
I know that @kevinswiber did some research on Spectral + AsyncAPI (https://github.com/kevinswiber/spectral-function-past-tense) and also plans to write an article about it. the only problem is that just |
Our js parser alone weighs something like 700-800 kbs after minification, just to remind you 😏 Running spectral as a separate tool involves validating the whole spec twice, once on the parser-js side and once on the spectral side - with medium sized specs this can be a serious problem due to memory consumption and speed. Also spectral only supports 2.0.0 version of AsyncAPI and that's another problem. In general, 500kb doesn't necessarily mean that it's actually added to the final bundle, because it's not the minified code but the weight of the code in the package. |
something to check for sure
not a problem IMHO. They keep asyncapi format in Anyway, I think we are going away from the initial goal of the issue 😄 |
This issue has been automatically marked as stale because it has not had recent activity 😴 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 ❤️ |
This issue has been automatically marked as stale because it has not had recent activity 😴 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 ❤️ |
This issue has been automatically marked as stale because it has not had recent activity 😴 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 ❤️ |
In Parser v2 we have improved error handling, but we still need that library https://github.com/asyncapi/problem to use. |
This issue has been automatically marked as stale because it has not had recent activity 😴 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 ❤️ |
Reason/Context
On the Slack, there was a discussion in which several proposals were proposed to improve the handling of errors in parser.
Description
Proposals:
Add
custom-validation-error
new error type for custom validation like: validate variables of server name etc...Create the predefinied classes for error types like in models:
custom-validation-errors
, forchannels
,server-variables
etc. It would be great if it will be implemented with HTTP Problems RFC.The text was updated successfully, but these errors were encountered: