DevTools

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 →
Loading tool…

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

  1. Paste or upload your OpenAPI 3.x spec (JSON or YAML) in the left editor.
  2. Choose a target language — TypeScript for a full client, or Go/Python/Kotlin/Java/Zod for models.
  3. The generated code appears on the right as you edit; copy or download it from the output toolbar.
  4. 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