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
fix(client): Serialize all Floats in exponential notation #15879
Conversation
It does not seem that it was indendened for snapshot serizier to apply to select.test.ts. Instead, we are fixing the failure by changing the number so it won't be replaced by serializer.
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.
Hi @cmd-johnson!
Thank you for the great contribution, especially adding both unit & integration tests!
I've made a couple of changes to the PR:
- converted intergration test to a functional one. This a newer, more powerful test suite and we generally add new tests there and consider integration suite to be a legacy.
Once CI is green, I'll merge your contribution. Then, it will be released as a part of prisma 4.6.0.
Also fixes #15551 UPD: I went ahead and updated the PR message |
Co-authored-by: Alexey Orlenko <alex@aqrln.net>
This should fix #12651, #13317 and #15551 by always serializing Float fields in GraphQL queries in exponential notation.
I added a unit test for the serialization and a integration test that verifies that large floats can now be inserted into the database and updated other tests that used floats to match the new serialization behavior.
In order to properly test this, I also had to change the regex used by the
jestSnapshotSerializer
innormalizeMigrateTimestamps
, because it interfered with all long numbers in snapshots. E.g.-9.007199254740991e+15
would get replaced with-9.202012310000001e+15
, which made snapshots appear to test for a wrong value. I updated snapshots that had the same problem accordingly.Fixes #12651
Fixes #13317
Fixes #15551