Skip to content

v3.3.0

Compare
Choose a tag to compare
@samchungy samchungy released this 30 Oct 11:00
· 26 commits to master since this release
4639070

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