Skip to content
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

BigInt serialization configuration #266

Open
beeb opened this issue Mar 6, 2023 · 3 comments
Open

BigInt serialization configuration #266

beeb opened this issue Mar 6, 2023 · 3 comments

Comments

@beeb
Copy link

beeb commented Mar 6, 2023

When using BigInt, the generated client uses i64 which leads RSPC to generate a TS binding using bigint as the type.

However, when passing this as value to the RSPC endpoint, JS complains that it can't serialize it as JSON. How can I overcome this limitation to use prisma-client-rust with RSPC using Bigint? Not sure if this is an RSPC issue or prisma one, sorry if I posted in the wrong repo.

Cheers

@beeb
Copy link
Author

beeb commented Mar 6, 2023

It seems bigint is not supported (or at least won't be in 0.2.0) by rspc: specta-rs/rspc#106

What's the plan for prisma-client-rust? Generating bindings that use string and automatically serialize/deserialize i64 maybe?

@Brendonovich
Copy link
Owner

Usually if people have issues with BigInt and Specta we tell them to use #[specta(type = String)] and serialize as string, but you're right in that you can't exactly do that with a Prisma client.
Perhaps I could add an option to the generator that would do so.

@Brendonovich Brendonovich changed the title Problem with BigInt and RSPC BigInt serialization configuration Mar 7, 2023
@Brendonovich Brendonovich added this to the 0.7.0 milestone Mar 7, 2023
@beeb
Copy link
Author

beeb commented Mar 7, 2023

That would be very helpful I think, thanks for the acknowledgment!

@Brendonovich Brendonovich removed this from the 0.7.0 milestone Mar 29, 2023
@Brendonovich Brendonovich added this to the 0.7.0 milestone May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants