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

Allow coercing types other than Date #237

Open
RuntimeRascal opened this issue Jan 15, 2024 · 1 comment
Open

Allow coercing types other than Date #237

RuntimeRascal opened this issue Jan 15, 2024 · 1 comment

Comments

@RuntimeRascal
Copy link

RuntimeRascal commented Jan 15, 2024

Is your feature request related to a problem? Please describe.
A way to coerce types such as Int from a Prisma schema. I am very new to both Prisma and Zod (first time using either) and seams the way to use a html input (which works with string) to represent a number type and db value type is to coerce it.

Describe the solution you'd like
Would expect to use the following in a Prisma schema.

    /// @zod.coerce.number.min(1, { message: 'Number must be greater than zero'})
    someNum                 Int

Describe alternatives you've considered
Very tedious to write onChange handlers to coerce things manually.

Additional context
Error message
[@zod generator error]: 'coerce' is not a valid validator type.

@roman-chivo
Copy link

Any update on this? I also need that functionality

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

2 participants