Skip to content

feat: upgrade to Zod v4 and use native JSON schema generation - #254

Merged
hustcc merged 3 commits into
antvis:mainfrom
chentsulin:feat/upgrade-zod-v4
Jan 19, 2026
Merged

feat: upgrade to Zod v4 and use native JSON schema generation#254
hustcc merged 3 commits into
antvis:mainfrom
chentsulin:feat/upgrade-zod-v4

Conversation

@chentsulin

@chentsulin chentsulin commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Upgrade zod from ^3.25.16 to ^4.3.5
  • Upgrade @modelcontextprotocol/sdk from ^1.11.4 to ^1.25.2
  • Remove zod-to-json-schema dependency and migrate to Zod v4's native toJSONSchema() method

Changes

This PR modernizes our dependency stack by adopting Zod v4, which includes native JSON schema generation capabilities. This allows us to remove the external zod-to-json-schema package, reducing dependencies and using the official Zod v4 API.

Key changes:

  1. Dependency updates: Updated Zod to v4.3.5 and MCP SDK to v1.25.2
  2. Schema generation: Migrated from zod-to-json-schema to Zod's native toJSONSchema() method
  3. Code cleanup: Removed the TODO comment as Zod v4 is now stable

Test plan

  • Verify all existing functionality works with the new Zod v4 API
  • Test JSON schema generation produces expected output
  • Run test suite to ensure no regressions
  • Verify MCP SDK compatibility with updated version

- Upgrade zod from ^3.25.16 to ^4.3.5
- Upgrade @modelcontextprotocol/sdk from ^1.11.4 to ^1.25.2
- Remove zod-to-json-schema dependency
- Migrate to Zod v4's native toJSONSchema() method
- Remove TODO comment as Zod v4 is now stable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @chentsulin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the project's dependency stack by upgrading Zod to its fourth major version and updating the Model Context Protocol SDK. The primary impact is the simplification of JSON schema generation, moving from an external library to Zod v4's native toJSONSchema() method, which reduces the project's external dependencies and streamlines the schema generation process.

Highlights

  • Dependency Upgrade (Zod): Zod has been upgraded from version ^3.25.16 to ^4.3.5, bringing in its native JSON schema generation capabilities.
  • Dependency Upgrade (MCP SDK): The @modelcontextprotocol/sdk dependency has been updated from ^1.11.4 to ^1.25.2.
  • Simplified JSON Schema Generation: The external zod-to-json-schema library has been removed, and the project now utilizes Zod v4's built-in toJSONSchema() method for generating JSON schemas.
  • Code Cleanup: A TODO comment regarding Zod v4 stability in src/utils/schema.ts has been removed as Zod v4 is now stable and in use.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request successfully upgrades Zod to v4 and migrates from zod-to-json-schema to the native toJSONSchema method, which is a great modernization step. The dependency changes in package.json are correct. My review focuses on src/utils/schema.ts, where I've identified a couple of important behavioral changes resulting from this migration related to the generated JSON schema. I've provided a suggestion to align the new implementation with the previous behavior where appropriate and to improve code clarity.

Comment thread src/utils/schema.ts
@codecov-commenter

codecov-commenter commented Jan 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.01%. Comparing base (0bd0233) to head (0727f20).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
- Coverage   81.02%   81.01%   -0.01%     
==========================================
  Files          42       42              
  Lines        1982     1981       -1     
  Branches       31       31              
==========================================
- Hits         1606     1605       -1     
  Misses        374      374              
  Partials        2        2              
Files with missing lines Coverage Δ
src/utils/schema.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hustcc

hustcc commented Jan 19, 2026

Copy link
Copy Markdown
Member

fixed #163

@hustcc
hustcc merged commit a16720f into antvis:main Jan 19, 2026
1 check passed
@chentsulin
chentsulin deleted the feat/upgrade-zod-v4 branch January 21, 2026 05:28
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.

3 participants