OpenAPI2Code

Turn { } into code.

Paste an OpenAPI or Swagger spec and get typed models in TypeScript, Zod, Swift, Kotlin, or Dart — generated in your browser. Nothing you paste ever leaves your machine.

Open the editor
{
"Pet": {
"name": { "type": "string" }
}
}
TypeScript export interface Pet {
Zod const PetSchema = z.object({
Swift struct Pet: Codable {
Kotlin data class Pet(
Dart class Pet {
Loading WASM module...

What is OpenAPI2Code?

OpenAPI2Code is a zero-dependency code generator for OpenAPI and Swagger specs. Paste or upload a spec above and get typed models for your target language back — entirely in your browser. The playground runs the same Go engine as the CLI, compiled to WebAssembly, so nothing you paste here is ever sent to a server.

Supported targets

TypeScript interfaces
Zod runtime schemas
Swift Codable structs
Kotlin data classes
Dart classes

How it works

  1. 1 Paste a spec, or pick one of the examples above.
  2. 2 Choose a target and, optionally, modular output.
  3. 3 Copy the generated code straight into your project.

Get the CLI

Prefer a command line? The same engine ships as a single static binary. Downloads are coming soon.