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

[Feature Request] Support for bigint coercion similar to date() #266

Open
JackMBurch opened this issue Jul 30, 2024 · 0 comments
Open

[Feature Request] Support for bigint coercion similar to date() #266

JackMBurch opened this issue Jul 30, 2024 · 0 comments

Comments

@JackMBurch
Copy link
Contributor

When parsing rest API responses back to prisma types using the generated schemas it's often an issue for bigints as they have to be converted to strings. It would be great to have them coerced back into bigints automatically when using the schemas parse similar to how dates are currently.

Implementation would change generated schemas from something like this:

export const EmailVerificationsSchema = z.object({
  id: z.bigint(),
  userId: z.bigint(),
  token: z.string(),
  createdAt: z.coerce.date(),
});

to this:

export const EmailVerificationsSchema = z.object({
  id: z.coerce.bigint(),
  userId: z.coerce.bigint(),
  token: z.string(),
  createdAt: z.coerce.date(),
});
@JackMBurch JackMBurch changed the title Support for bigint coercion similar to date() [Feature Request] Support for bigint coercion similar to date() Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant