OpenAPI TypeScript Code Generation Online
Paste an OpenAPI specification and instantly generate TypeScript types for every schema and API operation. Everything runs in your browser — your spec is never uploaded.
OpenAPI to TypeScript Converter
Paste an OpenAPI 3.x or Swagger 2.0 spec (JSON or YAML) and generate TypeScript interfaces, types, and API operation types. Handles $ref resolution, allOf/oneOf/anyOf, enums, and nested objects.
Options
How It Works
Schema Conversion
Extracts all schemas from components.schemas (OpenAPI 3.x) or definitions (Swagger 2.0) and generates TypeScript interfaces or type aliases with proper types, optional fields, and nested objects.
$ref Resolution
Follows $ref pointers within the spec to resolve references to other schemas, producing clean type names (e.g., $ref: "#/components/schemas/Pet" → Pet).
Composition Types
Handles allOf (intersection types), oneOf and anyOf (union types), and enum values as string literal unions.
API Operation Types
Optionally generates typed path parameters, query parameters, request bodies, and response types from your API's path definitions. Uses operationId for naming.
Supported Features
Type | nullRecord<string, T>Why generate TypeScript from OpenAPI?
OpenAPI specifications define your API's contract — the request and response shapes, parameter types, and available endpoints. Generating TypeScript types from this contract ensures your frontend code stays in sync with your API, catching type mismatches at compile time rather than runtime. This is especially valuable in large codebases where APIs evolve frequently.
How does online codegen compare to CLI tools?
CLI tools like openapi-typescript-codegen (2.14M weekly npm downloads) are great for CI pipelines, but an online converter is faster for one-off tasks: reviewing a new API's types, prototyping a client, or checking what types a spec produces before committing to a code generation pipeline. DevBolt's converter handles the same core features — $ref resolution, composition types, enums — without installing anything.
Frequently Asked Questions
What OpenAPI versions are supported?
DevBolt supports OpenAPI 3.0.x, 3.1.x, and Swagger 2.0 specifications in both JSON and YAML formats. The converter auto-detects which version you're using.
Does this tool handle $ref and allOf/oneOf/anyOf?
Yes. $ref pointers within the spec are resolved to clean TypeScript type names. allOf becomes intersection types (A & B), while oneOf and anyOf become union types (A | B).
Is my API specification uploaded to a server?
No. The entire conversion runs client-side in your browser using JavaScript. Your OpenAPI spec never leaves your device.
Related Convert Tools
JSON to CSV Converter
Convert JSON arrays to CSV with nested object flattening, column selection, and .csv download
TOML ↔ JSON/YAML
Convert between TOML, JSON, and YAML — perfect for Cargo.toml and pyproject.toml
Encode / Decode Multi-Tool
Base64, Base32, Hex, Binary, URL, and HTML encoding & decoding all in one tool
HTML to JSX Converter
Convert HTML to JSX instantly — class to className, inline styles to objects, self-closing tags, SVG attributes, event handlers, and more