validation based on other field in schema #1361
Unanswered
Hooman-studio
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone!
I am just starting with zod, and I can't seem to figure out a way to do the following:
["one", "two", "three"]
one
don't add any fieldtwo
I want the schema to have a required fieldextra
of type string.three
I want the schema to have a required fieldanother_extra
of type stringI have read about descriminative unions, but ideally I don't want the enum type to be inside a union (i want it to be accessible as
schema.myEnum
notschema.myUnion.myEnum
Wondering if there is a way to accomplish this!
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions