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

Deprecate "exact values" setting from JsonNodeFactory, replace with JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES #3651

Closed
cowtowncoder opened this issue Nov 6, 2022 · 0 comments
Labels
2.15 Issues planned for 2.15 node-config Related to JSTEP-7 Node config/feature

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Nov 6, 2022

(note: follow-up to #3650)

With Jackson 2.x there is a setting in JsonNodeFactory that determines whether BigDecimal values are normalized upon read (default) or not. Default value of normalization seems surprising to users, but there is a use-case for normalization too (specifically, trying to normalize JsonNodes to be logically equal for comparisons).

There are 2 main problems:

  1. Configurability by having to create and configure JsonNodeFactory is non-obvious and cumbersome
  2. Default to normalization seems unexpected by many users.

Changing 2 would be easy, but changes behavior so will need to wait either until 3.0, or at least 2.16 if and when the other part goes in 2.15.

So let's:

  1. Add JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES, to have precedence over other settings
  2. Leave JsonNodeFactory setting in place, deprecated
  3. Change code to do "normalization" in caller (JsonNodeDeserializer) NOT in JsonNodeFactory

This allows users to migrate to using JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES for configurability while retaining old behavior for old code.
We can then consider default changes for a later version, separately.

@cowtowncoder cowtowncoder added 3.x node-config Related to JSTEP-7 Node config/feature labels Nov 6, 2022
cowtowncoder added a commit that referenced this issue Nov 6, 2022
cowtowncoder added a commit that referenced this issue Nov 6, 2022
@cowtowncoder cowtowncoder changed the title Remove "exact values" setting from JsonNodeFactory, replace with JsonNodeFeature.NORMALIZE_BIG_DECIMAL Remove "exact values" setting from JsonNodeFactory, replace with JsonNodeFeature.STRIP_BIG_DECIMAL_ZEROES Nov 7, 2022
@cowtowncoder cowtowncoder changed the title Remove "exact values" setting from JsonNodeFactory, replace with JsonNodeFeature.STRIP_BIG_DECIMAL_ZEROES Deprecate "exact values" setting from JsonNodeFactory, replace with JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES Jan 25, 2023
@cowtowncoder cowtowncoder added 2.15 Issues planned for 2.15 and removed 3.x labels Jan 25, 2023
valfirst added a commit to vividus-framework/vividus that referenced this issue Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.15 Issues planned for 2.15 node-config Related to JSTEP-7 Node config/feature
Projects
None yet
Development

No branches or pull requests

1 participant