Any reason for this new zod schema generation behavior? #2443
Replies: 2 comments 7 replies
-
The change in your generated Zod schema is likely due to updates in openapi-ts's schema generation logic. Recent versions (notably v0.74.0) introduced a new approach that generates a single, more unified schema per endpoint, which can affect how empty objects and additional properties are represented in Zod. While the docs don't explicitly mention the switch from The "Unmergable intersection" error happens because Zod can't intersect a fixed-shape object (like The Zod plugin is still in beta, so schema generation details may change between versions see plugin docs. If you need the old behavior, you may need to pin your openapi-ts version or adjust your OpenAPI spec to clarify the intended object structure. If your schema should be an empty object, make sure your OpenAPI definition doesn't allow additional properties. If it should allow arbitrary keys, you'll need to update your validation logic to handle the new schema shape. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
@bombillazo Probably related to changes introduced in #2352 Can you drop your spec there, highlighting the issue? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I havent narrowed down the root cause, although I suspect a version change, but why would my generated Zod schemas change using the latest openapi-ts version?:
Due to this change, my response validation is failing with
Unmergable intersection
error. It was working with the previous pattern.Beta Was this translation helpful? Give feedback.
All reactions