Closed PaschalisDim closed 4 months ago
Hi there. Please see previous issues on the topic -- no changes are needed in the library here to do this. If you care about precision, deserialize your JSON using decimal.Decimal
or Fraction
yourself, before handing it off here to this library, and then everything works as you'd like!
(And for everyone else who doesn't care or prefers floats for performance, they too can get what they want).
The current implementation of the multipleOf function within the jsonschema library is designed to determine if a given instance is a multiple of a specified value. This function checks if the instance is of type float and then proceeds with the division and comparison operations. However, this implementation does not account for decimal numbers explicitly, which can lead to inaccuracies when dealing with high-precision decimal calculations.
To address this issue, I propose enhancing the condition within the multipleOf function to include checks for instances of the decimal.Decimal type.