Skip to content

openapi-typescript alternative with Zod v4 validation

The TypeScript OpenAPI space is crowded and mature. hey-api, orval, kubb, and openapi-typescript / openapi-fetch are all good tools and in some areas more featureful than this one. If you want the broadest plugin ecosystem, the widest mock-generation tooling, or hooks for every framework, one of them is probably the better pick, and that is fine.

This page exists so you can decide quickly and fairly. It is kept deliberately honest: where the alternatives are ahead, that is stated plainly. A comparison that only flatters itself is not worth reading.

Most generators treat your generated code as disposable: every run overwrites everything, so the output is a black box you are not meant to touch. openapi-zod-ts is built around the opposite idea. The Zod schema file is bootstrapped once and then yours forever, the client uses native fetch with no runtime library, and the core generator is 2.x and deliberately small rather than a moving target. (The packages are versioned independently: the openapi-zod-ts generator is 2.x, react-query 3.x, server 2.x, api-errors 1.x, and openapi-msw 0.x.) You trade breadth for ownership and stability.

openapi-zod-tshey-apiorvalkubbopenapi-fetch (maintenance mode)
TypeScript typesYesYesYesYesYes
Fetch clientYesYesYesYesYes (is the client)
Runtime library added to your appNone (native fetch)None (client bundled)Mutator, often axiosClient of choice~6 kb required
Zod schemas generatedYes (opt-in)Yes (plugin)YesYesNo
Zod versionv4v3 (plugin)v3v3n/a
Runtime request + response validationYesYes (Zod plugin)Yes (Zod)Yes (Zod)No
Schema file you own, never overwrittenYesNoNoNon/a
React Query / TanStack hooksYes (React)Yes (multi)Yes (multi)Yes (React, Vue, SWR)Companion pkg (maintenance mode)
Hooks for Vue / Svelte / Angular / SolidNoYesYesVueVia ecosystem
Server-side service interface + routerYes (framework-agnostic by default; Fastify / Hono / Express adapters)NoNoNoNo
Mocks (MSW / faker)Yes (openapi-msw, MSW v2 + Faker)Yes (plugin)YesYesNo
128-spec compatibility matrix in CIYes (Stripe, GitHub, OpenAI, Spotify, and more)NoNoNoNo
Mutation testing (Stryker)Yes (openapi-zod-ts, openapi-react-query)NoNoNoNo
OpenAPI 3.1YesYesYesYesYes
Swagger 2.0NoNoYesYesNo
Stable release with semverYes (core generator 2.x, semver)No (0.x)YesYesYes (no longer actively bumped)
Actively maintainedYesYesYesYesNo (maintenance mode)

You own the Zod schemas

With input_schema enabled, schemas.ts is written once and then never touched again. Add refinements, custom error messages, and business rules. Re-running the generator overwrites the client and types but leaves your schemas alone. Every other tool here regenerates schemas on every run, so hand edits do not survive.

Full-stack from one spec

The only tool in this set that also generates the server side: a service interface that is framework-agnostic by default (none), plus an optional router for Fastify, Hono, or Express. Fastify is the framework the project ships its canonical full-stack reference on. One spec drives the client, the hooks, and the server contract, validated at both ends.

Nothing in your bundle

The generated client uses only native fetch. The generator is a devDependency. openapi-fetch ships a small runtime library you import; orval and kubb generate code that calls a client you install. Here, nothing the codegen produces lingers in production that your project did not already have.

Boring on purpose

The core openapi-zod-ts generator is 2.x and semver-stable, proven on 128 real-world specs in CI with live smoke tests, mutation testing, and published provenance. A code generator has a wide blast radius; for this layer of your stack, predictable beats cutting-edge.

Being honest about this is the point.

openapi-typescript / openapi-fetch: where it wins

Section titled “openapi-typescript / openapi-fetch: where it wins”

Lightness and TypeScript-first design. openapi-typescript generates a paths type from your spec with zero runtime output. openapi-fetch wraps that with a ~6 kb client that keeps all type information at the TypeScript layer. If you want the absolute minimum surface area and do not need runtime validation or server generation, the combination is hard to beat for sheer lightness. There is no codegen step for the client itself; you install the packages and point them at a generated type file.

The important caveat: both packages entered maintenance mode in mid-2025 (Discussion #2559). For a new project today, that is a meaningful factor.

Adoption, ecosystem, and plugin breadth. hey-api is used by Vercel, OpenCode, and PayPal. It has 20+ plugins covering MSW, Cypress, MCP adapters, custom transformers, and hooks for React, Vue, Svelte, Angular, and Solid. The community around it is large and active. If your team values picking the project with the most momentum and the widest ecosystem, hey-api is the clear leader.

Multi-framework hook generation. If your frontend is not React, hey-api is likely the better pick. We generate React Query v5 hooks only.

Swagger 2.0 and multi-framework. orval reads Swagger 2.0 specs and generates clients and hooks for multiple frameworks. If you are stuck on a Swagger 2.0 spec or need Vue, Svelte, or Angular hooks, orval handles cases this toolchain explicitly excludes.

Mock generation depth. orval has a mature Faker and MSW mock story with more configurability than @codewithagents/openapi-msw today. If rich mock generation is the primary driver, orval leads on ecosystem maturity in that area.

Plugin meta-framework and multi-framework targets. kubb is built as an extensible plugin platform. It supports React, Vue, and SWR hooks, Swagger 2.0 input, and a plugin API designed for teams that want to bolt on custom transformers, Cypress fixtures, or other code generation steps. If you want to treat OpenAPI generation as a programmable pipeline with many output targets, kubb is built for that use case.

Coming from openapi-fetch or one of these?

Section titled “Coming from openapi-fetch or one of these?”

Migrating from openapi-fetch

Migrating from hey-api or orval