-
Notifications
You must be signed in to change notification settings - Fork 201
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: Duplicate keys in JSON produced for Catalog objects #915 #955
Conversation
…to pojo.mustache, the custom script changed the property to Existing_property
api/management-model/src/test/java/org/apache/polaris/core/admin/model/README.md
Outdated
Show resolved
Hide resolved
...gement-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
Outdated
Show resolved
Hide resolved
...gement-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
Outdated
Show resolved
Hide resolved
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 fix! Left a few comments
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 your contribution, @vedansh-5 !
...gement-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
Outdated
Show resolved
Hide resolved
...gement-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
Outdated
Show resolved
Hide resolved
…ore each test and removed the readme.md file
private Catalog verifyRoundTrip(Catalog original) throws JsonProcessingException { | ||
String json = mapper.writeValueAsString(original); | ||
Catalog deserialized = mapper.readValue(json, Catalog.class); | ||
assertThat(deserialized).usingRecursiveComparison().isEqualTo(original); |
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.
Why not simply assertThat(deserialized).isEqualTo(original)?
Do you think the .equals()
method in Catalog
does not take nested objects into account?
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 you patience @vedansh-5 !
The current state of this PR LGTM 👍
@flyrain @eric-maynard @dennishuo : Please double check mustache changes.
@snazy : Could you have another look too? |
@snazy : I have worked on the proposed changes, could you please take another look at them. Thankyou for your feedback. |
Hi @snazy, |
Are there test cases ensuring that the type-field itself is only serialized once? |
type-field serialized once
I have added test case for the same. |
And where? I don't see any executed test case that checks it. |
...gement-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
Outdated
Show resolved
Hide resolved
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.
Good point by @snazy
@vedansh-5 : IIRC, we have a test validating the serialized JSON string at some point... I guess it was lost in the refactrorings. Cf. #955 (comment)
Please re-add a test method that asserts the exact JSON string form of a java Catalog
object.
I have added the test method and using |
...gement-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
Show resolved
Hide resolved
@snazy: I made the requested changes. When you have some time, could you please take another look? |
Previously flagged issues have been addressed
Title
fix: Remove duplicate type field in Catalog serialization
Description
Problem
The Catalog API responses were showing duplicate
type
fields due to Jackson's polymorphic type handling.Solution
Files Changed
api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
api/management-model/templates/typeInfoAnnotation.mustache
(New)Testing
Screenshots
Closes #915