jarvisbox

OpenAPI 3.x to TypeScript types in browser

Convert OpenAPI 3.0.x and 3.1.x specs to TypeScript interfaces. Supports requestBody, components/schemas, $ref, anyOf/oneOf, and nullable — zero installation.

OpenAPI 3.x is the current standard for describing REST APIs. It introduced components/schemas (replacing Swagger 2.0's definitions), requestBody for typed request payloads, and a richer content map on responses. OpenAPI 3.1 further aligns with JSON Schema draft 2020-12, adding support for const, prefixItems, and dropping the non-standard nullable flag in favour of type: [string, null].

The OpenAPI to TypeScript browser generator handles all three subversions (3.0.0 through 3.1.x). It detects the spec version from the openapi field and applies version-aware parsing — for example, recognising both nullable: true (3.0.x) and type: ["string", "null"] (3.1) as producing string | null in the output.

OpenAPI 3.x features in the generated types

How to use

  1. Go to OpenAPI to TypeScript Types, paste your OpenAPI 3.x spec (JSON or YAML), and click Generate TypeScript.
  2. Review the generated types in the preview panel. Schemas map to named interfaces under components.schemas; path operations map to paths entries.
  3. Download types.d.ts and import it into your project alongside openapi-fetch or any typed HTTP client.

Related tools

回報這個工具的問題