OpenAPI to Client Code Generator
Paste or open an OpenAPI 3 or Swagger 2 document and get typed models, a client class and call examples in TypeScript, Python and Go.
Se ejecuta en tu navegador. Tus archivos nunca salen de tu dispositivo. Cómo comprobarlo
…
Cómo hacerlo
- 1Load the description
Press Open OpenAPI file, paste YAML or JSON into the document box, or press Load sample.
- 2Check the summary
Read the API name, number of operations and models, auth type and any warnings.
- 3Name things
Set the class name, Go package and an optional base URL.
- 4Read the clients
Open TypeScript, Python and Go to read and copy the generated code.
- 5Try an operation
Open Examples per operation, pick an operation and copy the call in your language or curl.
- 6Download everything
Press Download all (ZIP) for the three clients, README and EXAMPLES.md.
Sobre esta herramienta
When an API publishes an OpenAPI description, nobody should have to type its models by hand. Code generators exist, but they usually need Java or Docker, produce dozens of files and pull in runtime libraries. This generator works in the browser and writes one readable file per language with no dependencies beyond the usual HTTP library: a fetch-based TypeScript client with interfaces for every schema, a Python client built on requests with TypedDict models, and a Go client using net/http with structs and JSON tags. Every operation becomes a typed method with path, query, header and body parameters, authentication is wired from the security schemes, and each operation gets examples in TypeScript, Python, Go and curl.
Who this is for
Front-end and backend developers integrating a partner API, teams that want a lightweight internal SDK, and API designers who want to see what consumers will get from their description.
Input
OpenAPI 3.0 and 3.1 in YAML or JSON, and Swagger 2.0 (definitions, body and formData parameters, host and basePath). Local references to schemas, parameters, request bodies and responses are resolved. Inline object schemas are given names from their place in the document, for example PetOwner for the owner property of Pet, so every object becomes a real type.
What is generated
- TypeScript: interfaces and type aliases, enums as string unions, nullable as `| null`, an ApiError class and a client whose methods return typed promises. - Python: TypedDict models with NotRequired for optional fields, Literal for enums, a requests.Session based client with snake_case method names and timeouts. - Go: structs with json tags and omitempty, pointers for optional values, string enum types with constants, a Params struct for query and header parameters and context-aware methods. - README with an operation table, and EXAMPLES.md with ready calls in every language plus curl.
Authentication
The first security scheme is used: bearer tokens, HTTP basic or an API key in a header or the query string. The client takes the token or key in its options.
Worked example
For the Bookshop sample, the operation getBook with path parameter bookId becomes `getBook(bookId: string): Promise<Book>` in TypeScript, `def get_book(self, book_id: str) -> "Book"` in Python and `func (c *Client) GetBook(ctx context.Context, bookId string) (*Book, error)` in Go. The inline stock object inside Book becomes its own BookStock model in all three languages.
Limits
The output is a starting point that you own; it is not regenerated automatically when the API changes. Discriminators and complex oneOf polymorphism map to unions in TypeScript and Python and to json.RawMessage in Go. Cookie parameters, XML bodies, callbacks, webhooks and response headers are not generated. External references to other files must be bundled into one document first.
Ejemplo práctico
getBook(bookId) → TypeScript Promise<Book>, Python get_book(book_id) -> Book, Go GetBook(ctx, bookId) (*Book, error); inline stock object → BookStock.
Datos rápidos
- Categoría: Desarrollo y datos
- Funciona en tu navegador, sin registro y sin subir nada.
- Lo que introduces se queda en tu dispositivo.
- Disponible en inglés.
- Contenido revisado por última vez:
- Fuente oficial: OpenAPI Specification 3.1.0 and 3.0.3 (OpenAPI Initiative); Swagger 2.0 specification
Preguntas frecuentes
Which OpenAPI versions are supported?
OpenAPI 3.0.x and 3.1.x in YAML or JSON, and Swagger 2.0. Other files must be converted first.
Do the clients need extra libraries?
TypeScript uses the built-in fetch, Go uses only the standard library and Python needs requests and typing_extensions.
How are optional fields handled?
TypeScript marks them with ?, Python wraps them in NotRequired and Go uses pointers with omitempty so that missing values are not sent.
What happens with inline objects?
They are hoisted to named models based on where they appear, such as PetOwner or CreatePetRequest, so you can import and reuse them.
Can I change the base URL?
Yes. Set Base URL in the tool, or pass baseUrl, base_url or BaseURL when you create the client at run time.
Is my API description uploaded?
No. Parsing and generation run in your browser; the document is saved only in local storage.
