-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the Double primative for JSON Schema "number" type #111
Use the Double primative for JSON Schema "number" type #111
Conversation
LGTM |
should we update the tests, too? Edit: We have to - CI tests are failing 🙈 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Just a matter of updating the tests.
@wilwade tests updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, thank you!
Published as part of |
Awesome, thank you for the fast turnaround 🙏 |
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
.