Generates TypeScript interfaces from an OpenAPI/Swagger spec.
OpenAPI to TypeScript turns the schema definitions in an OpenAPI or Swagger spec into TypeScript interfaces. Paste a JSON or YAML document and it reads the model schemas (from components.schemas in OpenAPI 3 or definitions in Swagger 2) and emits exported interfaces with the right property types. It is handy when you want typed models for an API client without pulling in a code generator or build step.
No. The conversion runs entirely in your browser and nothing is uploaded. Your spec never leaves your machine.
Both JSON and YAML are accepted. The tool first tries to parse the input as JSON and falls back to YAML if that fails.
It reads model schemas from components.schemas (OpenAPI 3) or definitions (Swagger 2.0). Paths, operations, parameters, and responses are not converted, so only your data models become interfaces.
A $ref is converted to the referenced schema's name as a TypeScript type. Enums become a union of their literal values, for example "a" | "b".
Properties listed in a schema's required array are emitted as required, and any others are marked optional with a question mark. Integer and number types both map to number.