-
-
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
message examples invalid against avro payload #772
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
I think you are completely right @chrispatmore 👍 Wanna propose a change for it? |
Will give it a shot when I get a moment |
Hi, I'm going to need some help with some questions before I can complete this. In https://github.com/asyncapi/parser-js/blob/master/src/ruleset/v2/ruleset.ts
My questions are:
Sorry for the faff, just want to make sure I do the right thing? |
Any thoughts @jonaslagoni |
Sorry @chrispatmore, must have missed the notification.
No, should definitely not check anything related to message examples, which I don't think it does 🤔 It only look into examples in schemas.
If you think it needs to be clearer sure 👍
Only change 2 I think. I think the solution is in this line: https://github.com/asyncapi/parser-js/blob/481b24e8f6e2216d0ea5c3d9bb95c938f4736eef/src/ruleset/v2/ruleset.ts#LL231C33-L231C63
It does however not account for when a user explicitly defines the AsyncAPI Schema object as |
Thanks for the update. I was going to fix by getting the code to properly validate the example against the schema, rather than skipping the validation. Unless you think that's not a good idea? |
Ah I think I see now why you're suggesting that fix. Because nothing today is doing any validation of an object against a schema defined in another format. |
Alright so, up for discussion I guess @jonaslagoni.
I feel that 2 is a more complete solution that is better for user, but bigger change. |
Then you would probably need to rename the rules to be schema specific 🙂 I would say it's perfectly fine to go with option 1, that provide a fix for this bug. Then you can raise a feature request asking for examples to be validated according to their schema format 🙂 |
Okay will do |
🎉 This issue has been resolved in version 2.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Describe the bug
When supplying an avro payload for a message, and supplying examples that match that payload the examples cause a validation error:
How to Reproduce
Use this example api:
Expected behaviour
I would expect that the parser would validate the examples against the avro schema and my async api would be valid.
Notes
I tried to look through the code to find where the issue was coming from, and my best guess is that
parser-js/src/ruleset/v2/functions/messageExamples.ts
Line 79 in 20be09d
The text was updated successfully, but these errors were encountered: