Fix: update zod-openapi to 5.4.5#151
Closed
gaetansenn wants to merge 1 commit into
Closed
Conversation
Upgrade zod-openapi library Cannot convert undefined or null to object apps/middleware dev: at Function.entries (<anonymous>) apps/middleware dev: at override (file:///Users/gaetansenn/Development/aromazone/middleware/node_modules/.pnpm/zod-openapi@5.4.3_zod@4.1.13/node_modules/zod-openapi/dist/components-DV_-zLJ6.js:206:39) apps/middleware dev: at JSONSchemaGenerator.override (file:///Users/gaetansenn/Development/aromazone/middleware/node_modules/.pnpm/zod-openapi@5.4.3_zod@4.1.13/node_modules/zod-openapi/dist/components-DV_-zLJ6.js:372:4)
mcampa
added a commit
that referenced
this pull request
May 22, 2026
Resolves the crash demonstrated in the previous commit. zod-openapi 5.4.4 fixes the discriminated union override path (reading anyOf instead of oneOf), 5.4.5 fixes type declarations, and 5.4.6 addresses additional Zod 4.3+ "cannot be represented in OpenAPI" compatibility issues. Also relaxes the zod devDep pin to ^4.1.13 so the test continues to exercise the previously-broken code path while allowing forward minor upgrades. Snapshot update is upstream zod behavior: the v4.1 UUID regex now includes the max UUID (ffffffff-ffff-ffff-ffff-ffffffffffff). Supersedes #151. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
4 tasks
Owner
|
Hi @gaetansenn — thanks for catching this! I've opened #162 which builds on your version bump:
Closing this in favor of #162 — full credit to you for the report. 🙏 |
mcampa
added a commit
that referenced
this pull request
May 22, 2026
Pin zod to 4.1.13 (where discriminated unions began emitting anyOf instead of oneOf) and add a test that calls generateOpenApiDocument on a router with a discriminated union input. With zod-openapi 5.4.2 the test fails with "Cannot convert undefined or null to object" in JSONSchemaGenerator.override, matching the stack trace in #151. Verified the test passes after bumping zod-openapi to 5.4.5, which is what #151 proposes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mcampa
added a commit
that referenced
this pull request
May 22, 2026
Resolves the crash demonstrated in the previous commit. zod-openapi 5.4.4 fixes the discriminated union override path (reading anyOf instead of oneOf), 5.4.5 fixes type declarations, and 5.4.6 addresses additional Zod 4.3+ "cannot be represented in OpenAPI" compatibility issues. Also relaxes the zod devDep pin to ^4.1.13 so the test continues to exercise the previously-broken code path while allowing forward minor upgrades. Snapshot update is upstream zod behavior: the v4.1 UUID regex now includes the max UUID (ffffffff-ffff-ffff-ffff-ffffffffffff). Supersedes #151. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mcampa
added a commit
that referenced
this pull request
May 22, 2026
5.4.0–5.4.3 crash when generating OpenAPI docs for routers with discriminated union inputs on zod >=4.1.13 (see #151). Tightening the peer dep prevents consumers from installing a known-broken range. Addresses Copilot review on #162. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mcampa
added a commit
that referenced
this pull request
May 22, 2026
…st (supersedes #151) (#162) * test: reproduce zod-openapi discriminated union crash from #151 Pin zod to 4.1.13 (where discriminated unions began emitting anyOf instead of oneOf) and add a test that calls generateOpenApiDocument on a router with a discriminated union input. With zod-openapi 5.4.2 the test fails with "Cannot convert undefined or null to object" in JSONSchemaGenerator.override, matching the stack trace in #151. Verified the test passes after bumping zod-openapi to 5.4.5, which is what #151 proposes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: bump zod-openapi to 5.4.6 to fix discriminated union crash Resolves the crash demonstrated in the previous commit. zod-openapi 5.4.4 fixes the discriminated union override path (reading anyOf instead of oneOf), 5.4.5 fixes type declarations, and 5.4.6 addresses additional Zod 4.3+ "cannot be represented in OpenAPI" compatibility issues. Also relaxes the zod devDep pin to ^4.1.13 so the test continues to exercise the previously-broken code path while allowing forward minor upgrades. Snapshot update is upstream zod behavior: the v4.1 UUID regex now includes the max UUID (ffffffff-ffff-ffff-ffff-ffffffffffff). Supersedes #151. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: raise zod-openapi peer dep to ^5.4.4 5.4.0–5.4.3 crash when generating OpenAPI docs for routers with discriminated union inputs on zod >=4.1.13 (see #151). Tightening the peer dep prevents consumers from installing a known-broken range. Addresses Copilot review on #162. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Upgrade zod-openapi library
Cannot convert undefined or null to object
apps/middleware dev: at Function.entries ()
apps/middleware dev: at override (file:///Users/gaetansenn/Development/aromazone/middleware/node_modules/.pnpm/zod-openapi@5.4.3_zod@4.1.13/node_modules/zod-openapi/dist/components-DV_-zLJ6.js:206:39)
apps/middleware dev: at JSONSchemaGenerator.override (file:///Users/gaetansenn/Development/aromazone/middleware/node_modules/.pnpm/zod-openapi@5.4.3_zod@4.1.13/node_modules/zod-openapi/dist/components-DV_-zLJ6.js:372:4)