Skip to content

Conversation

@ryansuhartanto
Copy link

Support both Zod version 3 and 4 in non-breaking way.

Motivation and Context

Simple PR to support latest Zod version (v4.1.12) that kept the older version.
This is achieved by bumping the minor version 3 to the latest maintained version (v3.25.76).

Note

This PR does not provide support for Zod v4 schema.

Users are required to import zod/v3 (instead of zod) when using Zod version ^4.
Existing codebases that depend on Zod version ^3 are unaffected.

How Has This Been Tested?

From running npm run test, the result are the same with the current main branch.

Summary of all failing tests
 FAIL  src/integration-tests/taskResumability.test.ts (17.241 s)
  ● Transport resumability › should resume long-running notifications with lastEventId

    expect(received).toBeGreaterThan(expected)

    Expected: > 0
    Received:   0

      198 |
      199 |         // Verify we received some notifications and lastEventId was updated
    > 200 |         expect(notifications.length).toBeGreaterThan(0);
          |                                      ^
      201 |         expect(notifications.length).toBeLessThan(4);
      202 |         expect(onLastEventIdUpdate).toHaveBeenCalled();
      203 |         expect(lastEventId).toBeDefined();

      at Object.<anonymous> (src/integration-tests/taskResumability.test.ts:200:38)


Test Suites: 1 failed, 39 passed, 40 total
Tests:       1 failed, 824 passed, 825 total
Snapshots:   0 total
Time:        34.156 s
Ran all test suites.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

I just replaced from 'zod' into from 'zod/v3' in the entire codebase.
zod/v3 export does exist in Zod version ^3.25:
https://github.com/colinhacks/zod/blob/v3.25.76/packages/zod/package.json#L34

Serve as the same purpose as #1102.
Does NOT provide Zod v4 support in #555.

@ryansuhartanto
Copy link
Author

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