chrishoermann / zod-prisma-types

Generator creates zod types for your prisma models with advanced validation
Other
578 stars 43 forks source link

[Feature Request] Make field required in resulting schema, but optional in DB #218

Open CyanoFresh opened 7 months ago

CyanoFresh commented 7 months ago

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

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