Skip to content

feat: support zod 4 alongside zod 3 - #192

Open
casualuser wants to merge 1 commit into
tinybirdco:mainfrom
webomage:feat/zod-4-support
Open

casualuser wants to merge 1 commit into
tinybirdco:mainfrom
webomage:feat/zod-4-support

Conversation

@casualuser

Copy link
Copy Markdown

Why (Rationale & Problem)

package.json pins zod: ^3.25.0. Consumers that have migrated to zod 4 (stable since mid-2025) cannot install the SDK without a peer conflict: every pnpm/npm install that pins zod 4 fails with ERESOLVE/ERR_PNPM_PEER_DEP_ISSUES, forcing --legacy-peer-deps or duplicate zod copies in the bundle (bundle-size + dual-parse behavior risk).

What For (Use Cases & Value)

  • Consumers pinning zod 4 can install the SDK with a clean dependency graph (single zod major).
  • Consumers still on zod 3 are unaffected: the range remains ^3.25.0 || ^4.0.0.
  • Zero migration work for SDK users: no public API or runtime behavior change.

How (Implementation, Invariants & Verification)

  • Ranges: zod widened to ^3.25.0 || ^4.0.0 in root package.json and mcp/package.json.
  • Blast radius: the core src/ tree has zero zod imports (hand-rolled branded validators); only the mcp workspace imports zod, and solely for z.string().describe(...) MCP tool schemas — all zod-4 compatible without source changes.
  • Verification (Linux x64, node >= 20, pnpm 10.28.2, zod 4.6.7):
    • pnpm install resolves zod 4.6.7 across both workspaces.
    • pnpm typecheck passes.
    • pnpm --filter mcp exec tsc --noEmit passes.
    • pnpm test:run: 1065/1065 tests passed under zod 4.

Widen zod to ^3.25.0 || ^4.0.0 in both the root and mcp workspaces so
consumers pinning zod 4 can install the SDK without peer conflicts.

The core src/ tree has no zod imports (hand-rolled validators), so the
relative impact is limited to the mcp workspace, which only uses
z.string().describe() for MCP tool schemas — all 1065 tests pass under
zod 4.6.7 with no source changes required.

Fixes tinybirdco#191

This branch has not been deployed

No deployments
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