OpenAPI Schema to TypeScript Types

OpenAPI Schema to TypeScript Types

Local Processing

Generate TypeScript interface and type definitions from OpenAPI 3.0 / Swagger JSON specifications.

How It Works & Processing Standards

Generate TypeScript interface and type definitions from OpenAPI 3.0 / Swagger JSON specifications.

Tool processing runs in your browser. If you create a calculator or conversion share link, its values are included in the URL. See the privacy policy for account, analytics and advertising data.

Current Limits

  • Maximum input length: 100,000 characters

For generating front-end types quickly from a backend API spec. Paste JSON OpenAPI and get an interface per schema.

Only components.schemas is converted; per-path request/response types are not. Convert YAML specs with YAML → JSON first.

What You Can Do

Schema → interface
Each schema in components.schemas becomes an exported interface.
Optional properties
Properties not in required get ?.

How to Use OpenAPI Schema to TypeScript Types

  1. 1
    Paste OpenAPIPaste the spec in JSON.
  2. 2
    Read the resultSee the generated types.
  3. 3
    CopyPaste into types.ts or similar.

Examples

User schema
Input: {"components":{"schemas":{"User":{"type":"object","required":["id"],"properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}}
Result: export interface User { "id": number; "name"?: string; }

Common Use Cases

  • Generating front-end types from an API spec
  • Checking code types against the spec

Frequently Asked Questions (FAQ)

Does integer become number?

Yes. TypeScript has no separate integer type, so both integer and number become number.

Have feedback or ideas for this tool? Suggest & Inquire →