Skip to content

Conversation

@GeKorm
Copy link

@GeKorm GeKorm commented Sep 27, 2025

As requested in #158

  • Update tests to reflect newest zod v4
  • Add legacy overrides script to support zod v3 + zod-openapi v4 as well as zod v4 + zod-openapi v5
  • Fix components schema merging

The problems with the existing implementation are:

  1. zod@v3.x.x with /v4 imports is not truly compatible with zod@v4.x.x.
  2. This code in standard-openapi messes up the zod@v4 schema and isn't needed, zod-openapi can handle it.
  3. As noted in the issue thread
    1. zod@v4 works with id, not ref.
    2. The mergeComponentsObjects step empties out the components object.

I tried to address everything in this PR mainly for illustrative purposes; we wouldn't want a fix for @standard-community/standard-openapi to be a patch in hono-openapi.
Additionally my solution to test the 2 version combinations of zod+zod-openapi doesn't seem robust, but I found no other sane way to do this. I tried various pnpm workarounds, as well as vitest module mocking and even a custom vite plugin, with no success. I hope there's a better way.

- Update tests to reflect newest zod v4
- Add legacy overrides script to support zod v3 + zod-openapi v4 as well as zod v4 + zod-openapi v5
- Fix `components` schema merging
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