-
Notifications
You must be signed in to change notification settings - Fork 47
Description
I ran the zod 4 update docs against server/zod. Hope this helps (at least logs) some required updates:
Key Compatibility Issues:
-
Internal Structure Access:
The library heavily relies on accessing._def
directly:const typeName: ZodFirstPartyTypeKind | "ConvexId" = zod._def.typeName;
But the Zod 4 migration guide explicitly states:
moves ._def The ._def property is now moved to ._zod.def.
This is a critical issue that would prevent the library from working correctly with Zod 4.
-
Function Returns API:
The library does have some backward compatibility:let returns = fn.returns ?? fn.output;
It checks for both
returns
andoutput
, which is good, but the core function API in Zod 4 has changed significantly. -
Schema Access Pattern:
Many of the helper functions likezodToConvex
andzodOutputToConvex
directly access internal properties of Zod schemas that have changed in Zod 4.
What This Means:
-
This version of convex-helpers is not compatible with Zod 4 without modifications.
-
You would need:
- An updated version of convex-helpers specifically built for Zod 4
- To modify the library code to use
._zod.def
instead of._def
- To update any other internal structure access patterns
-
The
returns
field mentioned in the previous document might work because the library explicitly checks for bothreturns
andoutput
, but the underlying validation mechanism would still fail due to the internal structure changes.