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

Allow JacksonJsonpMapper user provided ObjectMapper to maintain configuration #417

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

mluckam
Copy link
Contributor

@mluckam mluckam commented Oct 7, 2022

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:

  1. Default constructor still provides desired default configuration
  2. Provides more flexibility of configuration to the user
  3. Constructor with parameter ObjectMapper will be less confusing to the users

For context, the change was made in this commit.

@cla-checker-service
Copy link

cla-checker-service bot commented Oct 7, 2022

💚 CLA has been signed

@mluckam mluckam force-pushed the jackson_mapper_constructor branch from c6c8a90 to 64bd09f Compare October 7, 2022 21:40
@mluckam
Copy link
Contributor Author

mluckam commented Oct 28, 2022

@swallez would you mind providing feedback to this PR? It appears that you were the author of the constructor constraint in question, see commit.

@swallez
Copy link
Member

swallez commented Oct 31, 2022

@elasticmachine ok to test

Copy link
Member

@swallez swallez left a 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?

@mluckam mluckam force-pushed the jackson_mapper_constructor branch 2 times, most recently from 4cdf128 to ea429bf Compare October 31, 2022 16:50
Copy link
Member

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

@cesarlino
Copy link

cesarlino commented Nov 25, 2022

It is great to have that implemented. Thanks for that.
I am wondering if this will be in version 7.17.8 and when it is planned to release?

Thanks
Cesar

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

Successfully merging this pull request may close these issues.

3 participants