Generator
Clients, servers and docs from the contract
apigenie-generator turns API descriptions into clients and servers in six languages, and into documentation sites, with the libraries each language already uses.
- No API Genie runtime dependencyClient helpers are generated into your package. Servers use the target language's frameworks, not an API Genie runtime.
- Regenerate without replacing your handlersKeep your handlers outside the generated package. Regeneration replaces generated files, not your implementation. The guide shows the separation with a TypeScript server.
- Checked by a conformance suiteGenerated output is checked against snapshots and with language-specific tools. Contract tests exercise clients and servers; coverage and limitations vary by target.
One contract in, your code outside the package
Four kinds of output from the same file. The handlers of a generated server live in your files, and regeneration leaves them.
What a generated client looks like
The Fetch client has a typed function per operation. Types go in types.ts; request helpers go in runtime.ts. Both are generated into your package.
$ apigenie-generator client fetch orders.yaml -o client
$ ls client/src
index.ts metadata.ts operations.ts runtime.ts types.ts
$ # client/src/operations.ts, one function per operation:
/** Get an order */
export async function getOrder(params: GetOrderParams, options?: RequestOptions): Promise<Order> {
const result = await request(
{
method: "GET",
path: "/orders/{orderId}",
pathParams: { orderId: params.orderId },
security: [["ApiKey"]],
responseFormat: "json",
},
options,
);
return result as Order;
}Find a target for your contract
Language support depends on the input standard and the output you need. For Swagger 2.0 code generation, convert to OpenAPI first (experimental). The generator reference lists each target's options and limitations.
| Input | Generated output | Languages |
|---|---|---|
| OpenAPI 3.0 to 3.2 | API clients and servers | TypeScript, Java, Go, Python, C# and Elixir |
| AsyncAPI 3.x | Messaging clients and applications | TypeScript, Java, Go, Python, C# and Elixir |
| GraphQL | Absinthe servers | Elixir |
| Protobuf | gRPC clients and servers | Elixir |
| JSON Schema | Zod validation schemas (experimental) | TypeScript |
Frameworks your code can use
- TypeScriptFetch clients, Express, oRPC and MCP (experimental) servers, KafkaJS and WebSocket clients and applications, Zod schemas.
- JavaClients for Spring
RestClient,RestTemplate, OpenFeign or HTTP interfaces; Spring Boot servers; Kafka clients and applications. - Go
net/httpclients and servers, Kafka client packages and applications. - Pythonhttpx and Pydantic clients, FastAPI servers, aiokafka clients and FastStream applications for Kafka, RabbitMQ and MQTT.
- C#
HttpClientclients for .NET 8, ASP.NET Core Minimal API servers, Kafka clients and applications. - ElixirReq clients, Phoenix servers and channels, Absinthe GraphQL servers, and gRPC clients and servers on elixir-grpc.
Beyond code
- Documentation sitesA static site from OpenAPI, Swagger 2.0, AsyncAPI, GraphQL and Protobuf files, with search, Try it out, translations and Git changelogs.
- Test dataValues that conform to any schema of an OpenAPI document, one or many, as JSON or YAML.
- Validation schemasZod schemas from JSON Schemas (experimental).
- OverlaysOpenAPI and AsyncAPI code targets and
dataaccept--overlay, so generator settings stay outside the API description. Documentation, GraphQL and Protobuf targets do not.
Install
The CLI packages include apigenie-generator. Install with Homebrew or npm, or download a native package or archive. In Docker, use docker run --entrypoint apigenie-generator mykulyak/apigenie.