-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
.passthrough() pass through excess nested properties as well #2655
Comments
+1 |
For Zod 4 I'm exploring a way to set the object strictness setting globally. |
I have the same issue. I'm working on data types generated from an OpenAPI-based API that has many nested objects. The API specification explicitly allows implementors to add additional properties on mutual agreement. That means data validation must do what passthrough does, which is to check the things defined in the API spec but pass everything else through. But, as noted above, for nested objects With Joi, I get the desired effect this way:
Where Hence, if |
How can I get around this current limitation? I need to have a nested object with one specific rule, and then allow other fields, without knowing what they are beforehand. |
Hey @colinhacks! With Zod 4 in active development, I was wondering if the global object strictness setting you mentioned is planned to be included in the upcoming release? |
Appears
.passthrough()
only operates on root properties.Actual results
Expected results
Additional functionality which would be very handy, as it relates to nested properties:
.pick()
allow picking and choosing for nested propsThe text was updated successfully, but these errors were encountered: