-
-
Notifications
You must be signed in to change notification settings - Fork 14
chore: add parser function and corresponding unit tests #7
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remember that the diff interface will also need to support "bypassing" the parser. When integrated with the CLI or the Studio in the future, the flow can be that you request a diff
and the base document that you want to chance against another one is already parsed, so diff
interface should also accept AsyncAPIDocument. Just for the record, so we do not forget 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments :) Great job! Please wait for other reviews.
Please also start using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aayushmau5 Added a few comments. Please have a look.
if (isUrl(path)) { | ||
return parseFromUrl(path); | ||
} | ||
return parse(await readDocument(path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aayushmau5 What will happen if there is some error thrown by readFile
promise? I think we should catch that error. What're your views on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We thought about handling errors, but for the time being we have put it on hold.
Because in the future, we will have our own custom "Error Object" like the @asyncapi/parser
has. And currently the error being thrown by NodeJS is alright for our purpose.
@aayushmau5 Will you handle that PR in upcoming days? It has one month. Where we have blocker here? |
@magicmatatjahu I think there are no blockers as of now. This PR is good to be merged. |
@aayushmau5 You have one bug :) Please wrap URL constructor in the |
It's not that. The Also, let me fix that testing real quck. |
The windows check is failing due to their The logs don't say anything. |
@aayushmau5 You can replace all white chars to the empty string |
Kudos, SonarCloud Quality Gate passed!
|
Yup. That was a windows error. Fixed it for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
🎉 This PR is included in version 0.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This PR implements the Parser function which will be used to parse two AsyncAPI documents.
CC @vinitshahdeo