Replies: 1 comment
-
|
@sentik is the zod expert any thoughts here? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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?
Thanks for advice towards the right direction! :)
Lars
Beta Was this translation helpful? Give feedback.
All reactions