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] Make field required in resulting schema, but optional in DB #218

Open
CyanoFresh opened this issue Dec 1, 2023 · 0 comments

Comments

@CyanoFresh
Copy link

Is your feature request related to a problem? Please describe.
Add ability to mark field "required", even if it is optional in prisma schema (with ? mark)

model Model {
fieldA Int? /// @zod.custom.use(z.number().int().positive())
}

results in:

fieldA: z.number().int().positive().nullish(),

but desired:

fieldA: z.number().int().positive(),

Describe the solution you'd like

  • @zod.custom.use() should not implicitly add .optional() or .nullish() to the end of type
  • @zod.[...].required() will not make this field nullish

Describe alternatives you've considered
Extending a scheme and overwriting this field's type

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