Skip to main content
openapi-yagen

OpenAPI - Yet Another Generation ENgine

openapi-yagen is a small standalone binary. Generators are written in JavaScript with Jinja-like templates and do not require a separate language runtime.

1Install the CLIDetails
mkdir -p ~/.local/bin && curl -L https://github.com/openapi-yagen/openapi-yagen/releases/latest/download/openapi-yagen \
-o ~/.local/bin/openapi-yagen && chmod +x ~/.local/bin/openapi-yagen
2Generate a Kotlin Ktor clientDetails
curl -LO https://raw.githubusercontent.com/openapi-yagen/openapi-yagen/master/test/resources/petstore.yaml

openapi-yagen generate petstore.yaml \
-g https://raw.githubusercontent.com/openapi-yagen/openapi-yagen/master/generators/kotlin_ktor_client_generator/src \
-o generated \
-v packageName=com.example.petstore
3Use the generated clientDetails
val client = HttpClient(CIO) { install(ContentNegotiation) { json() } }
val petsApi = PetsApi(client, baseUrl = "https://petstore.example.com/v1")
val pets = petsApi.listPets(limit = 20)

Main features

Small standalone engine

The generator core is distributed as a small statically linked binary. JavaScript support is built in, so Node.js, Java, and other language runtimes are not required.

JavaScript and Jinja-like templates

Generators use modern JavaScript for logic and familiar Jinja-like templates for output, making them straightforward to write and customize.

Built-in OpenAPI version conversion

The engine converts between OpenAPI 2.0, 3.0, 3.1, and 3.2. A generator targets one 3.x version; when the engine adds another input version, existing generators keep their declared data shape.

Local or remote generators

Keep a generator with your project sources, package it as a ZIP, or load it directly from an HTTP or GitHub URL.

Selective file overrides

Replace only the generator files you need to adjust without copying or maintaining a complete fork.

Output post-processing

Run custom tools such as formatters, linters, or checkers on generated files as part of the same command.

Getting started

1

Install the CLI

Download the statically linked Linux binary from GitHub Releases.

Installation
2

Select a generator

Use one from this repository or provide your own directory or URL.

Generator collection
3

Run it against a spec

Set output options and variables, then integrate the generated files.

Generator tutorial