datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

Support `multipleOfPrecision`

Open karolzlot opened this issue 3 years ago • 0 comments
trafficstars

Is your feature request related to a problem? Please describe. Sometimes there is a need to have some way of representing money. JSON Schema offers multipleOfPrecision which could be used to limit possible values.

Describe the solution you'd like I think if JSON Schema contains multipleOfPrecision, then such number should be converted to ConstrainedDecimal offered by Pydantic. Currently datamodel-code-generator ignores multipleOfPrecision.

Describe alternatives you've considered n/d

Additional context https://stackoverflow.com/questions/27260587/decimal-precision-in-json-schema

https://stackoverflow.com/questions/54961638/what-are-some-ways-to-restrict-the-decimal-places-in-json-schema

https://stackoverflow.com/questions/40886252/defining-a-json-schema-currency-type

karolzlot avatar May 07 '22 12:05 karolzlot