zod-to-openapi
Reasonable, with limits. 6th of 9 OpenAPI tools.
zod-to-openapi builds an OpenAPI 3.0, 3.1 or 3.2 document from Zod schemas and registered routes. It is a solid, actively maintained choice for code-first APIs that already use Zod, and Hono's official OpenAPI middleware builds on it. It is narrower than the spec-first generators and doc renderers in this category, and much of its download growth comes through Hono rather than from people picking it directly.
Best for: TypeScript teams that already validate with Zod and want an OpenAPI document generated from those schemas, in any framework.
Scores
Overall6.9
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
It is a good, well-kept tool for writing OpenAPI from Zod in code, with current Zod 4 and OpenAPI 3.2 support and a light dependency footprint. Its scope is narrow: it writes the spec, and other tools in the category make the clients and docs. Lighter Zod-native rivals and Hono's wrapper are often the easier entry point, so it is a strong pick only for Zod-first teams.
- github.com/asteasolutions/zod-to-openapi/releases: Active releases through v9.1.0.
- github.com/samchungy/zod-openapi: Direct rival built on Zod-native metadata.
- npm downloadsLast4Weeks: Strong growth, mostly through packages that install it.
GPT-6.2 Sol: 7.2, likely 6.0 to 8.3
This is a strong pick for a new Zod 4 API that needs to publish an OpenAPI contract, especially when it needs 3.2 output. For teams starting with an existing spec, openapi-typescript handles type generation and Swagger UI handles interactive reference docs. Open schema-conversion bugs and reliance on one visible release maintainer keep the recommendation below the category’s top tier.
- github.com/asteasolutions/zod-to-openapi/blob/v9.1.0/README.md: Shows the full workflow from Zod models and routes to an OpenAPI document.
- openapi-ts.dev/introduction: openapi-typescript generates types from an existing OpenAPI spec.
- swagger.io/open-source/swagger-ui: Swagger UI renders interactive documentation from a spec.
- github.com/asteasolutions/zod-to-openapi/issues/400: A documented output error affects the current release.
- github.com/asteasolutions/zod-to-openapi/actions/workflows/publish.yml: The public release history shows concentrated ownership.
Needed by many4.1
How many developers need a tool for this job?
Claude Opus 5.5: 4.0, likely 3.0 to 5.5
It serves one slice of the OpenAPI job: code-first spec writing for projects that use Zod. Zod is very common, but many API teams start from a spec, use another validator, or let their framework write the document. It is narrower than peers like Swagger UI or openapi-typescript.
- github description: Generates OpenAPI docs from Zod schemas only.
- github.com/asteasolutions/zod-to-openapi: Requires Zod 4; Zod 3 users are left on 7.3.4.
GPT-6.2 Sol: 4.2, likely 3.0 to 5.4
OpenAPI is useful across many HTTP API projects, and State of JavaScript shows growing Zod use. This package serves the narrower group that defines its API models in Zod and generates the contract from code. It works across server frameworks, but the share of teams using that workflow is hard to measure.
- 2025.stateofjs.com/en-US/other-tools: The survey reports strong year-over-year growth for Zod.
- github.com/asteasolutions/zod-to-openapi/blob/v9.1.0/README.md: The generator uses Zod schemas and a framework-independent registry.
- reddit.com/r/node/comments/1xg4bxn/best_practices_for_openapi_spec_generation: Express developers discuss sharing validation schemas with the generator.
Helps a lot7.3
How well does it do the job for those who need it?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
It is mature and complete for its job. It has a registry for schemas, routes, webhooks and components, generators for OpenAPI 3.0, 3.1 and 3.2, and support for Zod 4 .meta(). Recent releases keep fixing edge cases such as nested discriminated unions and new string formats. The extendZodWithOpenApi patch and Zod-only scope are real limits, and lighter rivals exist.
- github.com/asteasolutions/zod-to-openapi/releases: v9.0 added OpenAPI 3.2; v9.1 fixed discriminators and added new string formats.
- github.com/asteasolutions/zod-to-openapi: Registry, registerPath and registerWebhook, plus the 3.0, 3.1 and 3.2 generators.
- github.com/samchungy/zod-openapi: Rival that relies on native .meta() and toJSONSchema without patching Zod.
- npm hasTypes: Ships its own TypeScript types.
GPT-6.2 Sol: 7.5, likely 6.3 to 8.5
Version 9.1.0 has a typed registry, clear examples, and three OpenAPI targets. Users report incorrect regex patterns and missing constraints on reused schemas, and Sam Chung’s zod-openapi provides explicit handling for distinct request and response shapes. Evidence on generation speed and AI-written integrations is thin.
- github.com/asteasolutions/zod-to-openapi/blob/v9.1.0/README.md: Documents supported types, overrides, and full API examples.
- github.com/asteasolutions/zod-to-openapi/issues/400: A user reproduced incorrect regex output on 9.1.0.
- github.com/asteasolutions/zod-to-openapi/pull/405: An open fix documents missing checks on reused schemas.
- github.com/samchungy/zod-openapi: The alternative generates distinct components for input and output.
Holds up over time6.6
Will it still be a good choice in two years?
Claude Opus 5.5: 6.5, likely 5.0 to 7.5
It had 12 releases and 62 commits in the last year, and the last push was in October 2026. It moved quickly to Zod 4 and OpenAPI 3.2. A small company team maintains it, with 34 contributors and 16 open PRs. The v9 breaking changes were limited to types. A risk is that Zod's native JSON Schema output and leaner rivals could shrink the need for it over time.
- github commitsLastYear / releasesLastYear: 62 commits and 12 releases in the last year.
- github openPullRequests: 16 open PRs and 30 open issues against 171 closed.
- github.com/asteasolutions/zod-to-openapi/releases: The v9 breaking changes were TypeScript interface changes only.
- zod.dev/json-schema: Zod 4 has a native toJSONSchema with an openapi-3.0 target.
GPT-6.2 Sol: 6.6, likely 5.1 to 7.9
The project recorded 62 commits and 12 releases in a year, including support for OpenAPI 3.2. The last release was in July, several fixes are still awaiting review, and recent releases have come from one visible publisher. The move to Zod 4 prompted migration complaints, while v9 made smaller changes to TypeScript interfaces. Hono’s ongoing use helps, though long-term funding and backup release ownership remain unclear.
- github commitsLastYear, releasesLastYear, contributors, latestRelease: 62 commits, 12 releases, 34 contributors, and a July release.
- github.com/asteasolutions/zod-to-openapi/actions/workflows/publish.yml: One maintainer published the visible recent releases.
- github.com/asteasolutions/zod-to-openapi/pull/405: A November regression fix was still open and awaiting review.
- github.com/asteasolutions/zod-to-openapi/releases/tag/v9.0.0: The major release added OpenAPI 3.2 and loosened two exported types.
- github.com/asteasolutions/zod-to-openapi/issues/340: Users reported friction migrating to Zod 4.
- github.com/honojs/middleware/blob/main/packages/zod-openapi/package.json: Hono middleware currently declares a dependency on 9.1.
Used widely5.3
How many use it, and is that growing?
Claude Opus 5.5: 6.0, likely 4.5 to 7.0
Downloads are 31.8M per 4 weeks, up 7.3x from a year ago, which is above the 4.1 median. Much of that comes from @hono/zod-openapi and other packages that install it, not from direct choices. ecosyste.ms counts only 39 dependent repos and 54 packages, far below openapi-typescript's 8,379. Direct users are probably in the tens of thousands.
- npm downloadsLast4Weeks: 31.8M now against 4.3M a year ago, a ratio of about 7.3.
- dependents: 39 repos and 54 packages, low against peers.
- github stars: 1,633 stars, small next to most peers.
- dev.classmethod.jp/articles/hono-zod-openapi-schema-driven-api-development: @hono/zod-openapi uses this library internally.
GPT-6.2 Sol: 4.5, likely 2.9 to 6.2
Four-week installs rose from 4.35 million to 31.83 million, about 7.3× year over year against the catalog median of 4.1×. That is close to Orval’s growth and trails openapi-typescript and Hey API. Hono’s middleware adds indirect installs, while the 39 indexed repositories, 54 dependent packages, and quiet social channels point to a smaller direct footprint. Partial coverage of scoped packages leaves the number of teams choosing it uncertain.
- npm downloadsLast4Weeks, downloadsSame4WeeksYearAgo, medianDownloadsRatio: Installs grew about 7.3× against a 4.1× catalog median.
- dependents, github stars, peers: 39 indexed repositories and 1,633 stars, below Orval and openapi-typescript.
- hackerNews stories, bluesky posts: Neither collector found a matching item.
- github.com/honojs/middleware/blob/main/packages/zod-openapi/package.json: Installing Hono’s middleware can install this package transitively.
Vouched for5.8
Who stands behind it being good?
Claude Opus 5.5: 5.0, likely 3.5 to 6.5
Hono's official OpenAPI middleware builds on it, which is the strongest sign of quality. Independent write-ups compare it with zod-openapi and Zod's native output, but there is no survey data. I found no Hacker News or Bluesky posts, and no named production users.
- hono.dev/examples/zod-openapi: Official Hono middleware that relies on it.
- issoh.co.jp/md/tech/5646: Independent October 2026 guide that tested v9.1.0 against the alternatives.
- hackerNews / bluesky: No stories and no posts.
GPT-6.2 Sol: 6.5, likely 5.3 to 7.6
Hono’s OpenAPI middleware builds on the package, and Polygon’s Apps team uses its registry in a Hey API plugin. Express developers also describe a practical workflow for sharing schemas between validation and documentation. These sources show that teams build on it, while project-specific satisfaction data and independent benchmarks remain sparse.
- github.com/honojs/middleware/blob/main/packages/zod-openapi/package.json: A maintained framework integration depends on the package directly.
- github.com/0xPolygon/apps-team-packages: Polygon’s shared tooling builds a Hey API plugin around the registry.
- reddit.com/r/node/comments/1xg4bxn/best_practices_for_openapi_spec_generation: Users discuss using the same Zod schemas for Express validation and OpenAPI.
Safe8.0
How safe is it to depend on?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
It has no known advisories, one runtime dependency (openapi3-ts) and an MIT licence. Zod is a peer dependency, not a bundled one. There is no OpenSSF Scorecard and the release process is not documented, which keeps the score from going higher.
- advisories total: 0 advisories.
- npm dependencies: 1 runtime dependency.
- scorecard: No Scorecard data.
- npm license: MIT.
GPT-6.2 Sol: 7.9, likely 6.5 to 9.1
The package is MIT licensed, has one direct dependency plus Zod as a peer, and has zero advisories in the supplied OSV record. Its GitHub Actions workflow runs tests and publishes to npm with provenance. The missing Scorecard and security policy, concentrated release ownership, and an open report concerning untrusted schema definitions leave some uncertainty.
- npm license, npm dependencies, advisories, scorecard: MIT, one direct dependency, zero OSV advisories, and no Scorecard result.
- github.com/asteasolutions/zod-to-openapi/blob/v9.1.0/package.json: Lists openapi3-ts as the direct dependency and Zod as a peer.
- raw.githubusercontent.com/asteasolutions/zod-to-openapi/v9.1.0/.github/workflows/publish.yml: The release workflow tests the package and publishes with provenance.
- github.com/asteasolutions/zod-to-openapi/actions/workflows/publish.yml: Recent successful publications show one recurring release actor.
- github.com/asteasolutions/zod-to-openapi/security: GitHub lists no repository security policy or published advisories.
- github.com/asteasolutions/zod-to-openapi/issues/351: An open user report raises concerns about untrusted schema definitions.
Good
- It has generators for OpenAPI 3.0, 3.1 and 3.2, plus a registry for schemas, paths, webhooks and security components.
- It supports Zod 4 and reads Zod's native .meta(), so simple cases need no extra API.
- It pulls in only one runtime dependency, uses the MIT licence and has no known advisories.
- Hono's official @hono/zod-openapi middleware uses it, which keeps it widely exercised.
Bad
- It only works with Zod, and it covers only writing the spec; it does not make clients or docs itself.
- The full .openapi() API means calling extendZodWithOpenApi to add a method to every Zod schema, which some teams avoid.
- Zod 3 users are stuck on 7.3.4, which the maintainers no longer actively support.
- samchungy/zod-openapi and Zod's own toJSONSchema now cover much of the same ground with less API surface.
The numbers
- npm downloads, 4 weeks
- 32M ×7.3 in a year
- GitHub stars
- 1.6k
- Commits, 12 months
- 62
- npm version
- 9.1.0 Jul 2026
- Versions, 12 months
- 12
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- None
- Licence
- MIT
Read on 21 November 2026 from GitHub (asteasolutions/zod-to-openapi), npm (@asteasolutions/zod-to-openapi), OSV and the OpenSSF Scorecard.
OpenAPI tools
- 8.1Scalar
- 7.7Orval
- 7.3Swagger UI
- 7.1Hey API
- 6.9Kubb
- 6.9zod-to-openapi
- 6.7Spectral
- 6.7Redoc
- 3.2openapi-typescript