zod
zod copied to clipboard
Option for strict objects by default
With deeply nested object .strict
must be added on every .object
to check all keys but is easy to forget that. Option should be on parse
function to check all objects strict by default. Could disable that on a particular object with z.object().strict(false)
. As example joi allows such option.
This is coming in Zod 4.
Is there roadmap to follow what else is coming in zod 4?
Not currently, since it's still in flux, but I'll be working to communicate this more completely soon.
I suggest something like parser = z.parser(options)
to pass options like strictObjects: true
so you have reusable parser object you can use all over project and use it like parser.parse(schema, object)
or schema.parse(parser, object)
. Can such design work?