jackson-module-jsonSchema icon indicating copy to clipboard operation
jackson-module-jsonSchema copied to clipboard

Use BigDecimal instead of Double in NumberFormat

Open georgewfraser opened this issue 10 years ago • 2 comments

JSON can have number values outside the range of double. Also, it's important that multipleOf have an exact representation to be interpreted correctly. BigDecimal is better for these reasons.

georgewfraser avatar Sep 23 '15 06:09 georgewfraser

I can see why this could be an improvement, but it would also be a backwards-incompatible change, and possibly break existing code. Is there anything we could do to alleviate those problems? Otherwise simple upgrade of module to 2.7 (where this could be merged) could break existing deployments.

cowtowncoder avatar Sep 23 '15 18:09 cowtowncoder

We could have two functions like:

private BigDecimal minimum;

public Double getMinimum() { ... }

@JsonIgnore
public BigDecimal getMinimumDecimal() { ... }

This would avoid breaking existing code, at the cost of carrying a little bit of legacy cruft forever.

georgewfraser avatar Sep 23 '15 19:09 georgewfraser