OpenAPI to TypeScript
Convert OpenAPI component schemas to TypeScript interfaces and types
About OpenAPI to TypeScript
Generates TypeScript declarations from the components.schemas section of an OpenAPI 3.x document in JSON or YAML, updating as you paste or edit. Object schemas become interfaces, with properties missing from required marked optional and descriptions kept as JSDoc comments, while enums, arrays and allOf, oneOf or anyOf compositions become type aliases. Handy for typing API clients and handlers without adding a code generator to your build.
Category: API.
Frequently asked questions
Does it generate request and response types for each endpoint?
▾
No. Only components.schemas is converted, and paths and operations are ignored. Responses that reference a component schema can use the generated type directly; inline schemas need to be moved into components first.
What happens with $ref references?
▾
A $ref to #/components/schemas/User becomes a reference to the User type and is never inlined, so self-referencing and circular schemas work. References to external files or other sections, such as #/components/responses, aren't resolved and end up as invalid type names you must fix by hand.
Are nullable, format and Swagger 2.0 definitions supported?
▾
No. A nullable: true flag doesn't add | null, OpenAPI 3.1 type arrays such as [integer, null] fall back to string, and format is ignored, so date-time stays string. Swagger 2.0 definitions aren't read either, because only components.schemas is used.
Do I need to install any runtime library?
▾
No. The output is pure TypeScript types — they are erased at compile time and add zero runtime overhead. Just copy the generated types into your project.