-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for ZodIntersection (and maybe ZodUnion?) #34
Comments
Yes, my schema support really only handled the stuff I used or added due to other user requests. I should go back and see if I can figure out a more general way to handle any zod schema. |
Unions are an interesting case - I don't think we can reasonably extract input props from any union, given the associated schemas could have conflicting rules. We can handle Discriminated Unions but it requires passing in data (the current value of the discriminant). I actually have an implementation of this that works. |
Similar to #25, if your schema is a
z.intersection(schema1, schema2)
orz.union([...schemas])
, it won't work with the hook.As you know, these schemas can get pretty complicated. In the case of intersection there are 2 branches of other zod types to collect fields from. Here's an initial stab that seems to work ok for my use case but could definitely be improved:
The text was updated successfully, but these errors were encountered: