-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: array schema is not being parsed correctly #156
Conversation
…a object instead of a LinkedHashMap. If it is an array of schemas, then it will be returned as an arraylist ( like before)
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
if (nodeType == JsonNodeType.OBJECT) { | ||
return readAsSchema(node, objectCodec); | ||
} | ||
// TODO: Implement handling of scenario when items is an array of schemas. Maybe return a List<Schema>? |
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.
Yes, let's try to return list of schemas, in case of array
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 add test case where items is an Schema
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.
Thanks for the feedback @Pakisan, I'll have a look and make the changes that you have suggested.
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.
Hi @Pakisan, I have modified the code to return a list of schemas if 'items' is defined as an array of schemas in the spec. I have updated the tests to cover this scenario (MessageWithArrayPayloadTest class).
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.
@Pakisan, I can't seem to find '1.0.0-EAP-3-SNAPSHOT' branch. Under active branches, I can only see the 'develop' branch. Could you please advise.
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.
@Pakisan, I can't seem to find '1.0.0-EAP-3-SNAPSHOT' branch. Under active branches, I can only see the 'develop' branch. Could you please advise.
Sorry, my bad. I pushed branch moment ago
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.
Thanks @Pakisan, I have now raised a PR on the '1.0.0-EAP-3-SNAPSHOT' branch.
I have also added the implementation of array schema parsing to v3.
@jaydeepk please switch to |
…f Schemas. Updated tests.
Merged - #159 |
Description
Fixes array schema parsing with the following caveats:
Once we have some clarity on whether we should be using 'prefixIems', or returning a list of schemas, we can implement it.
In the meantime, with this fix, if 'items' is a json schema, then it will get parsed to a 'Schema' object, instead of the LinkedHashmap which we get right now.
We are a bit blocked due to this, and this fix will allow us to proceed with using this library in our project to validate messages with array schemas
Related issue(s)
#154