feat!: drop Zod v3 support and remove vendored schema converter - #2465
feat!: drop Zod v3 support and remove vendored schema converter#2465HAYDEN-OAI wants to merge 3 commits into
Conversation
BREAKING CHANGE: Zod helpers now require Zod v4 schemas, and the optional Zod peer dependency is narrowed to ^4.0.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Castiron custom code✅ No new custom-code files detected. 32 mixed files remain; 0 existing customizations changed. Compared 32 existing customizations unchanged
A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 32900725487 --repo openai/openai-node \
--name castiron-custom-code-32900725487-1 --dir /tmp/castiron-custom-code-32900725487-1
git apply --stat /tmp/castiron-custom-code-32900725487-1/custom-code.patch
cat /tmp/castiron-custom-code-32900725487-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 9dd86484d9d5a2212ea8ec472fad6f76c747ba14 b6497c54fa7814ee7216524fc4d6b27e7325b3f0
python3 scripts/castiron/custom_code_report.py report \
--base 9dd86484d9d5a2212ea8ec472fad6f76c747ba14 \
--head b6497c54fa7814ee7216524fc4d6b27e7325b3f0 --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-b6497c54fa78
cat /tmp/castiron-custom-code-b6497c54fa78/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71b9ff03ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Requesting changes for the existing P2 discussion on examples/package.json:14. The updated examples import zod/v4 but remove their only transitive Zod provider without declaring Zod as a direct examples dependency; the SDK peer is optional, so independently installed examples fail with ERR_MODULE_NOT_FOUND. Please add a direct Zod 4 dependency to examples/package.json and update the lockfile. Existing inline discussion already captures the issue, so no duplicate comment is needed.
apcha-oai
left a comment
There was a problem hiding this comment.
[sdk codex review] Approved at 5780f7e after two independent full reviews of all 72 changed paths, including the complete removed converter/validator/test files and retained Zod 4 helpers, tests, examples, documentation and packaging. No substantiated blocking issue found.
The existing examples dependency finding (#discussion_r3856041936) is fixed by the direct Zod 4 dependency and matching lockfile importer. The five helpers retain Zod 4 Classic/Mini behavior, strict-schema normalization, named/escaped references, parser error behavior and the separate streaming partial-JSON parser; Zod remains optional for core SDK consumers.
I verified existing hosted results for this exact head: Node 22/24/26 each passed 5,597 handwritten tests plus 556 generated tests (one skip); lint, builds, published-source TypeScript 4.9/current checks and packed CJS/ESM checks passed. The current head-plus-base merge also passed 14 ecosystem fixtures and OkTest's 237 tests across 42 suites. These are hosted results, not tests or scans I ran locally.
This approval is for the explicitly proposed NEXT MAJOR release only. Removing Zod 3 support is intentionally breaking: do not publish this in a 7.x minor/patch release, and retain the documented ecosystem coordination before scheduling the major release. Approval does not authorize publishing or merging.
Immediately before submission, the PR remained open, non-draft and mergeable, authored by HAYDEN-OAI; PR base, actual merge-base and live main were all a90581e. Existing feedback was rechecked; no duplicate inline comment added.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Re-reviewed the updated commit and confirmed the previous blocker is fixed: examples now declare Zod 4 directly and the matching pnpm lock importer is updated. Zod 4 Classic/Mini behavior, optional-peer semantics, helper/privacy coverage, packed-package assertions, explicit Zod 3 migration guidance, and the documented semver-major adoption plan remain sound. Approved.
apcha-oai
left a comment
There was a problem hiding this comment.
(human): lets figure out when to do breaking changes manually
Summary
Breaking change: this proposal must target the next major SDK release. Do not publish it in a 7.x minor or patch release.
^4.0as an optional peer dependency and use Zod 4's native JSON Schema conversion for all five existing Zod helpers.zod-to-json-schemaimplementation, its strict-schema compatibility layer, the archived converter dependency from the examples workspace, and obsolete lint exceptions.ZodErrorbehavior, and non-strict Realtime input schemas.zod/v3, including v3 compatibility schemas created from an installed Zod 4 package.Compatibility and rollout
zod/v3under Zod 4, must recreate them withzod,zod/v4,zod/mini, orzod/v4-mini.TypeErroracross every helper and inside named schema definitions; TypeScript also rejects them at compile time.@langchain/openai, before scheduling the next major release.Validation
pnpm install --frozen-lockfile --store-dir /tmp/openai-node-zod-v4-pnpm-storepnpm lintpnpm exec tscpnpm build./node_modules/typescript-4-9/bin/tsc --project dist/src/tsconfig.json --noEmit --incremental false./node_modules/typescript/bin/tsc --project dist/src/tsconfig.json --noEmit --incremental falsepnpm exec publint distnode --experimental-strip-types scripts/test-packed-package.ts— CommonJS, ESM, optional-peer isolation, converter removal, streaming-parser preservation, and 1,104 source maps passed.OPENAI_TEST_SUITE=unit ./scripts/test --exclude tests/ecosystem-cloudflare-credential-lifecycle-security.test.ts— 143 suites / 5,518 tests passed.The complete unfiltered handwritten run passed 5,595 tests and hit two existing Cloudflare inode-fixture failures that reproduce unchanged on upstream
mainin this container. Those tests require/proc/<parent-pid>/fd/<fd>, which is unavailable in the container's PID namespace. Their test and production files are unchanged, and both remain enabled for normal CI.