Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Support for Zod 4 #1184

wants to merge 1 commit into from

Conversation

yoshi6jp
Copy link

I have added support for zod v4.

#1044

I have also added support for the following I have added support for

  • Fixed a type error in yup.
  • Option to use zod v3 in a zod v4 environment

@Copilot Copilot AI review requested due to automatic review settings July 21, 2025 02:22
Copy link

@Copilot Copilot AI left a 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 zodv4 schema type with updated type system for Zod v4 compatibility
  • Introduced zodImportPath configuration option for custom Zod import paths (e.g., zod/v3 compatibility 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

@mmahalwy
Copy link

@Code-Hex any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants