-
|
Hej everyone, we are generating our api types and dtos with orval, and now we are exploring to use zod for frontend validation. I discovered that orval also may generate zod schemas, which is very neat! Lets have a look at (partially) generated zod schema: All properties, that are not required, are marked optional. The backend api, which is written in Java, does not distinguish between undefined (--> optional) and null (--> nullable) values, they are interchangable. But the frontend validation using this schema would now complain about null values. So I would like to have nullish() (which combines optinal and nullable) instead everywhere optional is used. The schema I would love to see generated would look like this: Is there a way to accomplish that? Using a configuration option, a postprocessor or something? Lars |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
@sentik is the zod expert any thoughts here? |
Beta Was this translation helpful? Give feedback.
-
|
I had the same problem. I use this postprocess |
Beta Was this translation helpful? Give feedback.
I had the same problem. I use this postprocess