FasterXML / jackson-module-jsonSchema

Module for generating JSON Schema (v3) definitions from POJOs
371 stars 135 forks source link

Use BigDecimal instead of Double in NumberFormat #82

Open georgewfraser opened 9 years ago

georgewfraser commented 9 years ago

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.

cowtowncoder commented 9 years ago

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.

georgewfraser commented 9 years ago

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.