Overview of typed-openapi
maintyped-openapi is a tool designed to generate type-safe TypeScript API clients, TypeScript types, and runtime validators directly from an OpenAPI specification document.
It is designed to be flexible regarding how you consume the generated code:
- Types-only: Generate paths, parameters, responses, and endpoint contracts without adding runtime dependencies, allowing you to keep your existing HTTP layer.
- Runtime Validation: Generate validators using your preferred library (Zod, Effect, Valibot, ArkType, TypeBox, or Typia). It uses a 'runtime type sidecar' approach where validator implementations are kept in sibling declaration files to prevent large validator logic from slowing down TypeScript editor inference.
- Client Generation: Generate Fetch-based clients or integrate with other data layers like TanStack Query, Promise, or Effect.
- Specification Filtering: For large API specifications, you can filter the spec to generate a smaller, domain-specific client.