jarvisbox

Generate TypeScript types from OpenAPI YAML

Paste your OpenAPI YAML spec and convert it to a typed .d.ts file in seconds — entirely in your browser, no terminal or Node.js required.

OpenAPI specifications are most commonly authored in YAML because it is more readable than JSON for humans — less punctuation, inline comments, and multiline strings are easier to maintain. The downside is that YAML requires a parser before you can do anything with the spec programmatically.

This tool bundles the OpenAPI → TypeScript generator with a full YAML parser (js-yaml) so you can drop in a raw .yaml file or paste the YAML text directly. The generator handles OpenAPI 3.0.x, 3.1.x, and Swagger 2.0 YAML files. The output is a .d.ts file with typed paths, components.schemas, and a createClient<paths>() declaration.

If your YAML has syntax errors, the tool shows an inline error message with the offending line. Use the YAML Validator to diagnose structural problems before generating types.

How to convert OpenAPI YAML to TypeScript

  1. Go to OpenAPI to TypeScript Types and paste your .yaml spec into the text area. YAML is auto-detected by the absence of a leading .
  2. Click Generate TypeScript. The js-yaml parser runs in your browser — no file upload, no server round-trip.
  3. Download the generated types.d.ts and import it into your TypeScript project. Pass the paths interface to createClient<paths>() from openapi-fetch for end-to-end type safety.

YAML vs JSON for OpenAPI

Both YAML and JSON are valid OpenAPI formats. YAML is preferred for hand-authoring because of its readability; JSON is preferred for machine-generated specs (e.g. from a running server's /openapi.json endpoint). Either way, the generator accepts both — paste whichever format you have.

Related tools

反馈这个工具的问题