OpenAPI Code Generator
Turn an OpenAPI 3.x spec (JSON or YAML) into a typed TypeScript fetch client, or into models for Go, Python, Kotlin, Java, and Zod. Runs entirely in your browser.
Prefer the terminal? See the CLI equivalent →About the OpenAPI Code Generator
- OpenAPI 3.0 / 3.1
- TS client · Go/Python/Java/Kotlin models
- Runs in your browser
- Instant results
- 100% private — runs in your browser
- Free, no sign-up
Paste an OpenAPI (Swagger) 3.x document — JSON or YAML — and pick a target. For TypeScript you get a ready-to-use client: an interface for every schema under components.schemas, and one typed async function per operation that calls the endpoint with fetch. For Go, Python, Kotlin, Java, or Zod you get the schemas as models (structs, dataclasses, data classes, records). No CLI, no Java toolchain, no build step, and nothing is uploaded — the whole spec is parsed and the code generated locally in your browser.
The generated client is dependency-free: it uses the built-in fetch, interpolates path parameters, builds the query string, sends JSON request bodies, and returns the typed success response (or void for 204). A RequestOptions argument lets each call override the base URL, add headers, or pass an AbortSignal.
This is a pragmatic generator focused on the common cases. It resolves local $ref references and handles objects, arrays, enums, and nullable fields, path and query parameters, and application/json bodies. It does not (yet) unify allOf/anyOf/oneOf, handle header or cookie parameters, non-JSON content types, or authentication flows — so treat the output as an excellent starting point, not a full SDK.
How to use it
- Paste or upload your OpenAPI 3.x spec (JSON or YAML) in the left editor.
- Choose a target language — TypeScript for a full client, or Go/Python/Kotlin/Java/Zod for models.
- The generated code appears on the right as you edit; copy or download it from the output toolbar.
- For the TypeScript client, set BASE_URL (or pass baseUrl in RequestOptions) and call the generated functions.
What gets generated
- components.schemas
- Each becomes an exported interface, with required/optional and nullable fields.
- Operations
- One async function per path + method, named from operationId (or the method and path).
- Path params
- Positional, required function arguments interpolated into the URL.
- Query params
- Folded into an optional `query` object argument.
- Request body
- A typed `body` argument for application/json request bodies.
- Responses
- The success response schema becomes the Promise return type; 204 returns void.
Frequently asked questions
Does my API spec get uploaded anywhere?+
No. The spec is parsed and the client generated entirely in your browser with client-side JavaScript. Nothing is sent to a server — safe for internal or unreleased API specs.
Which OpenAPI versions are supported?+
OpenAPI 3.0 and 3.1, in either JSON or YAML. Older Swagger 2.0 documents are not handled; convert them to 3.x first.
Which languages can it generate?+
TypeScript produces a full client — typed interfaces plus a fetch function per operation. Go, Python, Kotlin, Java (records or Lombok), and Zod produce models (structs, dataclasses, data classes, records, schemas) from the spec’s components.schemas. A full HTTP client is generated for TypeScript only; the other targets give you the types to build against.
What does the generated client depend on?+
Nothing. It uses the built-in fetch and standard TypeScript types, so you can drop client.ts into any project without adding a runtime dependency.
How do I set the base URL?+
It defaults to the first entry in the spec’s servers list, emitted as a BASE_URL constant. You can edit that constant, or override it per call by passing { baseUrl } in the RequestOptions argument.
Why is a field typed “any” or an enum widened to string?+
Combinators (allOf/anyOf/oneOf) are not unified in this version and degrade to any, and enums are mapped to their underlying primitive rather than a literal union. These are deliberate v1 simplifications — the output is a starting point you can tighten by hand.
Works well with
OpenAPI Code Generator chains with these tools — send your result straight on:
Related tools
Barcode Generator
Generate 1D barcodes — CODE128, CODE39, EAN-13/8, UPC-A, ITF-14, MSI, Codabar and more — with live preview, colors, and PNG/SVG download, all in your browser.
Mock Data Generator
Generate realistic fake test data — names, emails, dates, and more — as JSON, CSV, SQL, or XML, from a schema you build or import.
PDF Toolkit
Merge, split, reorder, rotate, and delete PDF pages, turn images into a PDF, or export pages as images — entirely in your browser, nothing uploaded.
QR Code Generator
Generate QR codes for URLs, Wi-Fi, vCards, events, email, SMS, geo, phone, and text — with selectable error correction, and PNG/SVG download.
QR Code Reader
Decode a QR code from an image or your camera, entirely in your browser. Reads URLs, Wi-Fi, contacts, and more — nothing is uploaded.
Workflow Builder
Chain multiple tools into a pipeline and run it in one place: decode, convert, format, and generate types in sequence. Runs entirely in your browser.