[TypeGen]: add Zod 4.6 compilation and validation - #19
Open
RejectKid wants to merge 1 commit into
Open
Conversation
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.
Summary
Adds opt-in support for Zod 4.6's schema compiler and validation API while preserving the current generated output by default.
z.compile(...),z.toZod<T>()(...), and generatedisX(value)guards when enabled.z.lazy(...)only on cyclic schema edges, including self-referential DTOs.PatchField<T>omission semantics and keeps nullable schemas aligned with generated TypeScript in conformance mode.[ZIban]and.Iban(), and aligns credit-card validation with Zod's 12-19 digit behavior.The new behavior remains opt-in:
Examples and documentation
The TypeGen sample now demonstrates compiled/conforming schemas, validation guards, response parsing, credit-card and IBAN formats, ULIDs, hostnames, Base64/Base64URL, custom-length NanoIDs, and recursive models. The Validation sample demonstrates both
[ZIban]and fluent.Iban()usage.The package README and documentation site pages include configuration and generated-code examples. A design note records the Zod 4.6 choices, compatibility behavior, and deferred follow-ups.
Affected package(s)
Type of change
How was this verified?
dotnet build ZibStack.NET.slnx --no-restore— succeeded with 0 errors and no new warnings.tscagainst generated schemas and TanStack clients.dotnet test packages/ZibStack.NET.Validation/tests/ZibStack.NET.Validation.Tests/ZibStack.NET.Validation.Tests.csproj --no-restore— 73 passed.The solution continues to report existing warnings from vulnerable sample dependencies, intentionally unsupported sample DTO types, and the existing DTO sample generator warning.
Checklist
master, focused on a single changedocs/src/content/docs/and the package README[Package]: …prefix