OpenAPI to TypeScript
Generate dependency-free TypeScript interfaces and type aliases from OpenAPI component schemas or Swagger definitions without uploading the contract.
Processed locally · No upload · No generated runtime dependency
How to use it
- Paste OpenAPI JSON or ordinary YAML, drop a local file, or load the example.
- Select Generate TypeScript or press Ctrl/⌘ + Enter.
- Review optional fields, unions, references, and nested object shapes.
- Copy the output or download a
.tsfile for your project.
Generate models from reusable OpenAPI schemas
The generator reads reusable models from OpenAPI 3 components.schemas or Swagger 2 definitions. Plain object schemas become exported interfaces. Enums, arrays, composition schemas, and primitive definitions become exported type aliases. Property names that are not valid TypeScript identifiers are quoted, while schema names are converted into safe identifiers.
OpenAPI’s required array controls whether an interface property receives the TypeScript optional marker. A property absent from required becomes optional even when its schema has a type. OpenAPI 3.0 nullable: true adds null; JSON Schema and OpenAPI 3.1 type arrays can express null directly. String enums become literal unions, and arrays preserve their item type.
References and schema composition
Local $ref values are represented by the referenced component name, so a property pointing to #/components/schemas/User becomes User. The generator does not inline or download remote references. oneOf and anyOf become TypeScript unions, while allOf becomes an intersection. This keeps the generated declaration readable and mirrors the contract without introducing a code-generation runtime.
TypeScript’s structural type system and JSON Schema do not have identical semantics. An intersection may be impossible when member schemas conflict. Discriminators, numeric bounds, string formats, regex patterns, default values, examples, and read/write direction are not runtime checks in a TypeScript declaration. Use a runtime validator when untrusted API responses must be verified.
Models, not a complete API client
This tool deliberately generates model declarations only. It does not create Fetch or Axios calls, authentication handlers, server selection, query serialization, error classes, or operation-specific request types. Model generation is useful when you want lightweight shared shapes or need to inspect how a schema maps into TypeScript. A production SDK usually needs a versioned generator with tests for transport behavior and edge cases.
Before copying declarations into an application, run the OpenAPI Validator and OpenAPI Linter. Validate the exact artifact produced by CI rather than a mutable documentation URL. Regenerate types when the contract changes, and review the diff as source code instead of committing generated output without inspection.
Privacy and current limits
Parsing and generation run in the browser. Cryonel does not receive the specification, resolve remote references, contact declared servers, or execute examples. Even with local processing, remove secrets embedded in examples before sharing a generated report or downloaded file.
The built-in YAML reader supports common mappings, lists, and scalar values, not every YAML feature. The generator does not preserve descriptions as comments, emit branded scalar helpers, transform dates into Date, or create separate input and output models for readOnly and writeOnly. Those choices depend on project conventions and belong in a dedicated, pinned generator. Use OpenAPI Diff or API Guard to understand contract changes before regenerating models.
Frequently Asked Questions
Which schemas are generated?
The tool generates declarations from OpenAPI components.schemas or Swagger 2 definitions.
Does it generate an API client?
No. It generates reusable model declarations, not request functions, runtime validation, or transport code.
Is the OpenAPI document uploaded?
No. Parsing and TypeScript generation run entirely in the current browser tab.