v3.3.0
What's Changed
Minor Breaking Change
ZodCatch
is now properly treated as a Zod Effect. This is because ZodCatch
can take any invalid result, such as an undefined
and transform it. As a result, we now treat it the same as a ZodDefault
when it comes to schema generation.
Required Logic Changes
The way we determine if schemas are optional has been simplified and under the hood runs a .safeParse(undefined)
with the schema we are checking. This removes the double traversal of the schema and has highlighted a couple errors in the schema generation.
ZodCustom
should now be flagged properly as required
when a validating function is passed to it. Thanks @pmsfc
ZodUnion
can now accept z.undefined()
, z.literal(undefined)
, z.never()
values.
ZodObject
can now accept z.literal(undefined)
as a value.
New Contributors
Full Changelog: v3.2.0...v3.3.0