[TypeGen]: emit Zod 4 top-level format factories (fix #13)#14
Merged
Conversation
Closes #13. The Zod emitter produced z.string().uuid(), which Zod 4 deprecated. Switch to the top-level factories — z.uuid(), z.email(), z.url(), z.iso.datetime(), z.iso.date() — for both type mapping (Guid/DateTime/DateOnly) and attribute-driven formats ([ZEmail]/[ZUrl]). Drops support for the deprecated Zod 3 chained forms. Compilation tests now pin zod@4.4.3 (with --skipLibCheck/--esModuleInterop for zod 4's .d.cts files) and a new test type-checks the format factories against a real Zod 4 install.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13.
Problem
The Zod emitter generated
z.string().uuid(), which Zod 4 deprecated. Reported by @RejectKid in #13 — it should bez.uuid().Change
The emitter now always targets Zod 4 and emits the top-level format factories. Zod 3's deprecated chained forms are no longer supported.
System.Guidz.string().uuid()z.uuid()System.DateTimez.string().datetime()z.iso.datetime()System.DateOnlyz.string().date()z.iso.date()[ZEmail]z.string().email()z.email()[ZUrl]z.string().url()z.url()For attribute-driven formats,
ApplyStringFormatswaps thez.string()base for the factory so trailing.min()/.max()/.regex()still chain.Tests
zod@4.4.3(added--skipLibCheck/--esModuleInteropfor zod 4's.d.ctsdeclarations).Docs (
emitters/zod.md) updated; consumers shouldnpm install zod@^4.🤖 Generated with Claude Code