DevBolt
Processed in your browser. Your data never leaves your device.
← Back to tools

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

Samples:

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

Schema Types: string, number, integer, boolean, object, array
Composition: allOf, oneOf, anyOf, $ref
Enums: String and numeric enum → union types
Nullable: nullable: true → Type | null
Maps: additionalProperties → Record<string, T>
Output: interface or type alias, export, readonly, JSDoc
Specs: OpenAPI 3.0.x, 3.1.x, Swagger 2.0
Operations: Path, query, body, and response types

Related Convert Tools