Repository navigation
chore(deps): move to zod 4 and import the Zod 3 API from zod/v3 - #22
Closed
louis-bompart wants to merge 1 commit into
Closed
louis-bompart wants to merge 1 commit into
louis-bompart wants to merge 1 commit into
Conversation
Every in-repo import of 'zod' now reads 'zod/v3', and every workspace depends on zod@^4.6.7, which ships the Zod 3 API at that entry point. The code keeps using the Zod 3 API, so schemas and behavior are unchanged; this only moves the repo to one zod 4 copy, so that code can start using Zod 4 from 'zod' alongside it. - The schema generators write 'zod/v3', so regenerating changes nothing. - The root resolution pins zod to ^4.6.7, so third-party packages that accept Zod 4 share the same copy. - The MCP recipe and filesystem samples alias 'zod/v3' to their own copy, as they already did for 'zod', for the in-repo MCP catalog they bundle. - Docs and READMEs import from 'zod/v3'. Packages that take Zod schemas from their callers now need callers on the same zod@^4.6.7 copy, importing from 'zod/v3': noted as a breaking change in each published package's changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This moves the repo onto the
zod@4package while keeping the Zod 3 API: every in-repoimport … from 'zod'becomesimport … from 'zod/v3', and every workspace depends onzod@^4.6.7, which ships the Zod 3 API atzod/v3. The code and the schemas don't change; only where they're imported from does.Why
We want to move A2UI to Zod 4, starting with the basic catalog, without moving everything at once. That needs a single
zodcopy in the repo that offers both APIs.A partial bump doesn't work. I tried bumping only
@a2ui/web_core: it ends up with two copies of the Zod 3 types (3.25.76 andzod@4'szod/v3). Zod types are still part ofweb_core's public API, sotsccrashes (SIGABRT) or reports "Type instantiation is excessively deep" in every package that passes schemas to it. With a single copy, code can keep usingzod/v3and adopt Zod 4 fromzodfile by file.What changed
generate-zod-schemas, the catalog generators), now import fromzod/v3. Regenerating the generated schemas changes nothing else.zodgoes from^3.25.76to^4.6.7inweb_core, Lit, Angular, React (dependency and peer), vegachart, mcp,tools/composerandsamples/client/angular. The rootresolutionspin moves to^4.6.7, so third-party packages that accept Zod 4 share the same copy. Before, the pin forced them onto 3.25.76.samples/communityis a separate Yarn project that uses the published@a2ui/*packages, so it stays as it is. The two MCP sample clients bundle the in-repo mcp catalog, so their vite alias lists andtsconfigpaths gainzod/v3, as they already hadzod.zod/v3.Breaking change for consumers
Packages that take Zod schemas from their callers (
web_core, the renderers, the catalogs) need those callers on the samezod@^4.6.7, importing fromzod/v3. A caller still on Zod 3.25 gets a second copy of the types, and one writingimport {z} from 'zod'with Zod 4 gets Zod 4 schemas, which these APIs don't accept yet. This is noted as BREAKING CHANGE in the changelogs ofweb_core, Lit, Angular, React, vegachart and mcp.How it's tested
yarn workspaces foreach -A -p --topological-dev run buildand… run testpass in every workspace except one step, listed below. That coversweb_core(1061 tests plus conformance), Lit, React, Angular unit and integration, markdown-it, vegachart, mcp, the agent SDK, the editor, inspector and shell tools, the samples and the specification tests.main.test:closure-compiler, which needs Java 21. The machine I ran on has Java 8, so it fails before compiling.samples/community, which isn't installed in this checkout.Pre-launch Checklist
For this PR:
🤖 Generated with Claude Code