Fix Zod v4 oneOf unions in strict schemas#1896
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6713349141
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Quick follow-up on this. The oneOf semantics issue was addressed in the latest commit; happy to adjust the schema transform or test coverage if this needs a different shape. |
|
@kiwigitops thanks for sticking with this and for getting the original fix moving. appreciate your patience while we worked through the schema semantics and brought the branch current. merging now! 💚 |
Closes #1709
Zod v4 can emit
oneOffor discriminated unions, but strict OpenAI schemas supportanyOfinstead. This convertsoneOfunions before the existing strict-schema recursion runs, so nested discriminated unions are still processed normally.Verification:
yarn jest tests/helpers/zod.test.ts --runInBandyarn jest tests/lib/transform.test.ts tests/helpers/zod.test.ts --runInBandgit diff --check