Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

openapi-nexus is a modular OpenAPI code generator written in Rust. It reads an OpenAPI specification (3.0, 3.1, or 3.2) and produces type-safe client libraries for multiple languages.

Supported Languages

LanguageGenerator IDHTTP ClientStatus
TypeScripttypescript-fetchfetchBeta
Gogo-httpnet/httpBeta
Rustrust-reqwestreqwestBeta
Rustrust-urequreqBeta
Rustrust-aioductaioductBeta
Pythonpython-httpxhttpxBeta
Pythonpython-requestsrequestsBeta
Javajava-okhttpOkHttpBeta
Kotlinkotlin-okhttpOkHttpBeta

How It Works

openapi-nexus follows a compiler-like pipeline:

OpenAPI YAML / JSONParse (auto-detect OAS3.0 / 3.1 / 3.2)Lower to IR (IrSpec)CodeGenerator::generate(&IrSpec)Vec<FileInfo> →write to disk

Parsing and lowering happen once in the orchestrator. Each generator receives a pre-lowered IrSpec and produces a list of files. Generators use sigil-stitch for type-safe, import-aware code emission.

Key Properties

  • Deterministic output. The same spec always produces the same files. Golden tests enforce byte-for-byte reproducibility.
  • Compile-checked output. CI runs language-specific compile checks on every generated file: tsc --noEmit (TypeScript), go build (Go), cargo check (Rust), pyright (Python), gradle compileJava (Java), gradle compileKotlin (Kotlin).
  • Single binary. The CLI is a self-contained Rust binary with no runtime dependencies.