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
refactor: JsonSchema remove preserveSelfUnknownFields #4425
refactor: JsonSchema remove preserveSelfUnknownFields #4425
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.
Thanks a lot, @manusa for the cleanup!
One little note and LGTM.
if (p.isPreserveSelfUnknownFields()) { | ||
preserveSelfUnknownFields = true; | ||
} | ||
preserveUnknownFields = p.isPreserveUnknownFields(); |
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.
If I remember correctly this method can be called multiple times on object
s, so that the last property that affect the object may reset the flag, the gut feeling is to leave the if
:
if (p.isPreserveUnknownFields()) {
preserveUnknownFields = p.isPreserveUnknownFields();
}
but haven't checked the code carefully.
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.
I just removed the if-else clause because it seemed redundant, but what you say is true. I'll revert this change
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.
Looking at it again, and the same comment might apply to the other properties as well (min, max, pattern). 👍
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.
You're right. I changed them, please check again 🙏
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.
This encoding works for me 👍
I'm negatively surprised that the test suite is not able to catch a regression here 🙁
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.
A next step would be to implement tests that verify the described expected behaviors (multipass processing, etc.)
Signed-off-by: Marc Nuri <marc@marcnuri.com>
3b45d8c
to
dbb6163
Compare
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.
Given a green CI LGTM! Thanks again!
Kudos, SonarCloud Quality Gate passed! |
Description
refactor: JsonSchema remove preserveSelfUnknownFields
relates to: #4398
Type of change
test, version modification, documentation, etc.)
Checklist