Skip to content

Conversation

yoshi6jp
Copy link
Contributor

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?

@mmahalwy
Copy link

mmahalwy commented Aug 5, 2025

safe to say this repo is unsupported? @yoshi6jp @Code-Hex

@aledoroshenko
Copy link

Would love to see it merged 🙏

@EvgeniyKumachev
Copy link

any chance of merge?

@mmahalwy
Copy link

this repo probably abandoned?

@yoshi6jp
Copy link
Contributor Author

I have prepared a branch that includes the built wasm.

Pnpm users can install and check it from github.

pnpm add -D https://github.com/yoshi6jp/graphql-codegen-typescript-validation-schema#support-zod-v4-with-build-module

Please use it.

Copy link
Owner

@Code-Hex Code-Hex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoshi6jp Big thanks!

@Code-Hex
Copy link
Owner

@yoshi6jp I'm sorry too late. I understand that the usage will change slightly. Thank you for your hard work!

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.

5 participants