-
-
Notifications
You must be signed in to change notification settings - Fork 60
Support for Zod 4 #1184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Zod 4 #1184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Zod v4 to the GraphQL Code Generator validation schema plugin. The implementation introduces a new zodv4 schema type with updated type definitions and enum handling compatible with Zod v4, while providing backward compatibility through a new zodImportPath configuration option.
Key Changes
- Added
zodv4schema type with updated type system for Zod v4 compatibility - Introduced
zodImportPathconfiguration option for custom Zod import paths (e.g.,zod/v3compatibility layer) - Fixed a type error in the YUP implementation for better enum handling
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/zodv4/index.ts | New ZodV4SchemaVisitor implementation with updated Properties type and enum handling |
| src/index.ts | Registers the new zodv4 schema visitor |
| src/config.ts | Adds zodv4 to ValidationSchema type and zodImportPath config option |
| src/zod/index.ts | Implements zodImportPath configuration for custom Zod imports |
| src/yup/index.ts | Fixes type error in enum name resolution |
| tests/zodv4.spec.ts | Comprehensive test suite covering all zodv4 functionality |
| tests/zod.spec.ts | Tests for zodImportPath configuration |
| package.json | Adds Zod peer dependency and zodv4 type checking script |
|
@Code-Hex any news on this? |
|
Would love to see it merged 🙏 |
|
any chance of merge? |
|
this repo probably abandoned? |
|
I have prepared a branch that includes the built wasm. Pnpm users can install and check it from github. Please use it. |
Code-Hex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yoshi6jp Big thanks!
|
@yoshi6jp I'm sorry too late. I understand that the usage will change slightly. Thank you for your hard work! |
I have added support for zod v4.
#1044
I have also added support for the following I have added support for