Skip to content

Feat/zod v4 support #78

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 4 commits into
base: main
Choose a base branch
from

Conversation

sebastianwessel
Copy link

@sebastianwessel sebastianwessel commented Jun 20, 2025

This commit introduces support for Zod v4 alongside the existing Zod v3 compatibility.

See: #76

Key changes:

  • Updates peerDependencies and devDependencies to zod: ^3.25.67 to allow usage of Zod v4.
  • Modifies the Zod adapter to conditionally handle both Zod v3 and Zod v4 schemas.
  • For Zod v4 schemas, native toJSONSchema() is now used for JSON schema conversion, replacing zod-to-json-schema.
  • For Zod v3 schemas, zod-to-json-schema continues to be used.
  • Validation logic has been updated to use the correct parsing functions for Zod v3 and Zod v4 (zod/v4/core).
  • Resolver types have been updated to correctly infer input/output types for both Zod versions.
  • Comprehensive unit tests have been added to cover Zod v4 validation and serialization, and existing Zod v3 tests have been updated to ensure backward compatibility.

google-labs-jules bot and others added 2 commits June 20, 2025 21:40
This commit introduces support for Zod v4 alongside the existing Zod v3 compatibility.

Key changes:
- Updates `peerDependencies` and `devDependencies` to `zod: ^3.25.0` to allow usage of Zod v4.
- Modifies the Zod adapter to conditionally handle both Zod v3 and Zod v4 schemas.
- For Zod v4 schemas, native `toJSONSchema()` is now used for JSON schema conversion, replacing `zod-to-json-schema`.
- For Zod v3 schemas, `zod-to-json-schema` continues to be used.
- Validation logic has been updated to use the correct parsing functions for Zod v3 and Zod v4 (`zod/v4/core`).
- Resolver types have been updated to correctly infer input/output types for both Zod versions.
- Comprehensive unit tests have been added to cover Zod v4 validation and serialization, and existing Zod v3 tests have been updated to ensure backward compatibility.
Copy link

changeset-bot bot commented Jun 20, 2025

🦋 Changeset detected

Latest commit: b3278cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@typeschema/main Major
@typeschema/all Minor
@typeschema/zod Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

1 participant