-
Notifications
You must be signed in to change notification settings - Fork 249
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
Allow JacksonJsonpMapper user provided ObjectMapper to maintain configuration #417
Conversation
💚 CLA has been signed |
c6c8a90
to
64bd09f
Compare
@elasticmachine ok to test |
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 @mluckam. Your proposed changes totally make sense!
I've left a few minor comments about code formatting. Can you please fix it?
java-client/src/main/java/co/elastic/clients/json/jackson/JacksonJsonpMapper.java
Outdated
Show resolved
Hide resolved
4cdf128
to
ea429bf
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.
LGTM! Thanks for your contribution!
It is great to have that implemented. Thanks for that. Thanks |
The JacksonJsonpMapper has a public constructor that takes in a user provided ObjectMapper to allow customization for serialization and deserialization. The constructor can be misleading since it overrides two configurations to disable pretty print and disregard null values on serialization. As far as I can tell, there is no other way to modify the ObjectMapper configuration other than through the constructor.
The proposal is that these configurations be moved to the default constructor. This allows users with no preference to take the default configuration, but if custom configuration is desired a user can provide the ObjectMapper. A few advantages to this strategy:
For context, the change was made in this commit.