zod-prisma-types
zod-prisma-types copied to clipboard
[Feature Request] Make field required in resulting schema, but optional in DB
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