Skip to content
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

Merged
merged 1 commit into from Sep 19, 2022

Conversation

manusa
Copy link
Member

@manusa manusa commented Sep 16, 2022

Description

refactor: JsonSchema remove preserveSelfUnknownFields

relates to: #4398

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@manusa manusa added this to the 6.2.0 milestone Sep 16, 2022
Copy link
Member

@andreaTP andreaTP left a 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();
Copy link
Member

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 objects, 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.

Copy link
Member Author

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

Copy link
Member

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). 👍

Copy link
Member Author

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 🙏

Copy link
Member

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 🙁

Copy link
Member Author

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>
@manusa manusa force-pushed the refactor/preserve-unknown-fields branch from 3b45d8c to dbb6163 Compare September 19, 2022 07:41
Copy link
Member

@andreaTP andreaTP left a 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!

@sonarcloud
Copy link

sonarcloud bot commented Sep 19, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

84.0% 84.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants