Skip to content

adamcavendish/openapi-nexus

Repository files navigation

OpenAPI Nexus

OpenAPI 3.1 to multi-language code generator

CI License Rust

OpenAPI Nexus transforms OpenAPI 3.1 specifications into type-safe client libraries. Generated output is deterministic, compile-checked in CI, and tested byte-for-byte via golden tests.

Language Support

Language Generator Status
TypeScript (fetch) typescript-fetch Stable
Go (net/http) go-http Stable

Quick Start

Install

Download a binary from the releases page, or build from source:

cargo install --path crates/openapi-nexus

Requires Rust 1.90+.

Generate

# TypeScript client
openapi-nexus generate -i spec.yaml -o output -g typescript-fetch

# Go client
openapi-nexus generate -i spec.yaml -o output -g go-http

# Both at once
openapi-nexus generate -i spec.yaml -o output -g typescript-fetch,go-http

Configuration

Configuration resolves in order: CLI args > environment variables (OPENAPI_NEXUS_*) > config file (openapi-nexus-config.toml) > defaults.

# Environment variables
export OPENAPI_NEXUS_INPUT="spec.yaml"
export OPENAPI_NEXUS_OUTPUT="generated"
export OPENAPI_NEXUS_GENERATOR="typescript-fetch"

Generator-specific options go in the config file:

[generators.go-http]
module_path = "github.com/myorg/myproject/sdk"

How It Works

OpenAPI YAML/JSON → parse → lower to IR → CodeGenerator::generate(&IrSpec) → write

Parsing auto-detects OAS version. Lowering produces a version-agnostic IrSpec. Each generator receives the pre-lowered IR and uses sigil-stitch for type-safe code emission.

Documentation

Full documentation is available at the project docs site.

Development

# Run all tests
cargo test

# Clippy (required before commit)
cargo clippy --all-targets --all-features -- -D warnings

# Update golden files after intentional output changes
UPDATE_GOLDEN=1 cargo test

# Compile-check generated output
just golden::build-all

License

Dual-licensed under MIT or Apache-2.0 at your option.

About

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Languages