# OpenAPI to TypeScript

Generate TypeScript types from the schemas of an OpenAPI 3 or Swagger 2.0 document in YAML or JSON. Every entry under components.schemas, or definitions in Swagger 2.0, becomes an exported interface or type alias, $ref links between them become type names and nullable fields get | null.

## Frequently asked questions

### Which parts of the document are converted?

The schemas under components.schemas in OpenAPI 3 and under definitions in Swagger 2.0. Paths, parameters and responses are not turned into types; reference the generated schema types from your own request and response code.

### How are schema names turned into type names?

Each schema key is rebuilt in PascalCase, so user-profile becomes UserProfile. When two keys would produce the same name, the second one gets a number appended.

### Are nullable fields supported?

Yes. nullable: true from OpenAPI 3.0 and x-nullable: true from Swagger 2.0 add | null, and OpenAPI 3.1 type arrays such as ["string", "null"] become string | null.

### What happens to references the tool cannot resolve?

A $ref that points outside the document, or to something other than a schema in components.schemas or definitions, becomes unknown and is listed in a comment at the top of the output.

### Is YAML supported?

Yes. Paste the document as YAML or JSON. Anchors and aliases in YAML are expanded before the conversion.

### How do I check the document first?

Use the OpenAPI Validator, which lists structural problems and broken references. This converter only reads the schemas and does not report other errors.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
