The JSON Schema stipulates that a "number" type can be an integer, floating point, or exponential notation. Currently, the "number" type is treated the same as an integer when instantiating fromJSONSchema. In those cases, providing a float value of e.g. 2.5 will fail because it can't be converted into a BigInt.
Solution
I changed the primitive to Double for "number" types when creating a schema from JSON.
Expected behavior is that the file will be successfully written. Current behavior results in RangeError: The number 2.5 cannot be converted to a BigInt because it is not an integer.
Problem
The JSON Schema stipulates that a "number" type can be an integer, floating point, or exponential notation. Currently, the "number" type is treated the same as an integer when instantiating
fromJSONSchema
. In those cases, providing a float value of e.g.2.5
will fail because it can't be converted into a BigInt.Solution
I changed the primitive to Double for "number" types when creating a schema from JSON.
Change summary:
Steps to Verify:
Note: This is the example from the README.
Expected behavior is that the file will be successfully written. Current behavior results in
RangeError: The number 2.5 cannot be converted to a BigInt because it is not an integer
.