Convert OpenAPI/Swagger specs (JSON or YAML) to TypeScript interfaces, types, or Zod schemas.
Free online OpenAPI to TypeScript converter. Paste any OpenAPI 3.0/3.1 or Swagger 2.0 specification in JSON or YAML format and generate clean, fully-typed TypeScript interfaces, type aliases, or Zod validation schemas. Supports resolved $ref models, allOf/oneOf/anyOf union and intersection types, string enums, optional fields, JSDoc annotations, and endpoint path request/response types. Runs server-side with zero data storage.
Keywords: openapi to typescript, swagger to typescript, openapi to ts, swagger to ts interfaces, openapi typescript generator, convert swagger to typescript, openapi to zod, openapi typescript types, swagger type generator, openapi 3 to typescript, swagger 2 to typescript, generate typescript from openapi
Tags: openapi, swagger, typescript, types, interfaces, zod, converter, generator, api
Paste your OpenAPI 3.0, OpenAPI 3.1, or Swagger 2.0 specification in JSON or YAML format into the input editor on the left.
Choose your preferred output mode: TypeScript Interfaces (declaration merging), Type Aliases (unions/primitives), or Zod runtime validation schemas.
Configure type options including custom type prefix (e.g., Api or Dto), readonly properties, and export statements to match your coding standards.
Toggle "JSDoc" to retain OpenAPI schema descriptions, parameter notes, and summary documentation as native TypeScript docstrings.
Toggle "Path Types" to generate comprehensive request parameter interfaces, request body types, and response types for every REST endpoint.
Click "Convert" or press ⌘↵ (Mac) / Ctrl+Enter (Windows) to instantly execute the type generation engine.
Copy individual types or the entire generated TypeScript code, or click "Download" to save the file as types.ts or schema.ts.
Full specification compatibility: Seamlessly parses OpenAPI 3.0, OpenAPI 3.1, and Swagger 2.0 definitions.
Dual-format support: Automatically detects and parses JSON and YAML API schemas without manual configuration.
Three dedicated output targets: Generate TypeScript interfaces, TypeScript type aliases, or Zod schemas with inferred static types.
Complete $ref pointer dereferencing: Resolves nested, sibling, and circular internal reference pointers across components and definitions.
Advanced schema composition: Correctly models allOf (intersections/inheritance), oneOf (discriminated unions), and anyOf structures.
Rich JSDoc preservation: Converts OpenAPI descriptions and summary attributes into native JSDoc comments on types and properties.
Path & operation typing: Generates typed parameters (path, query, header), request payload types, and HTTP status code response types.
Enum & literal conversion: Converts OpenAPI string/number enums into type-safe string literal unions or typed constants.
Custom type prefixing: Prepend prefixes like "Api", "Dto", or "I" across all generated models to avoid collisions with local interfaces.
Immutability options: Add the readonly modifier to all generated interface properties for immutability-first architectures.
Runtime validation with Zod: Output includes Zod schemas with string format validations (email, uuid, url) and number constraints (min, max).
Private and secure: Spec conversion executes entirely in-memory with zero retention or external network logging.
Developer ergonomics: Full keyboard shortcut support (⌘↵ to convert, ⌘⇧C to copy, ⌘⇧K to clear).
The OpenAPI to TypeScript Converter supports 4 SQL dialects. Select the right dialect for accurate formatting and keyword recognition.