Skip to content

Allow JacksonJsonpMapper user provided ObjectMapper to maintain configuration - #417

Merged
swallez merged 1 commit into
elastic:mainfrom
mluckam:jackson_mapper_constructor
Oct 31, 2022
Merged

swallez merged 1 commit into
elastic:mainfrom
mluckam:jackson_mapper_constructor

Conversation

@mluckam

@mluckam mluckam commented Oct 7, 2022

Copy link
Copy Markdown
Contributor

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

cla-checker-service Bot commented Oct 7, 2022 •

Copy link
Copy Markdown

💚 CLA has been signed

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

mluckam commented Oct 28, 2022

Copy link
Copy Markdown
Contributor Author

@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

swallez commented Oct 31, 2022

Copy link
Copy Markdown
Contributor

@elasticmachine ok to test

@swallez swallez left a comment

Copy link
Copy Markdown
Contributor

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

@swallez swallez left a comment

Copy link
Copy Markdown
Contributor

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

cesarlino commented Nov 25, 2022 •

Copy link
Copy Markdown

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