Getting Started
Installation
Shell installer (no Rust toolchain needed):
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-codegen-group/openapi-nexus/releases/download/0.1.16/openapi-nexus-installer.sh | sh
Nightly build (latest main):
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-codegen-group/openapi-nexus/releases/download/nightly/openapi-nexus-installer.sh | sh
Build from source:
cargo install openapi-nexus
Requires Rust 1.90+ (edition 2024).
Basic Usage
Generate a TypeScript fetch client:
openapi-nexus generate \
--input path/to/openapi.yaml \
--output generated \
--generators typescript-fetch
Generate another target language into a separate directory:
openapi-nexus generate \
--input spec.yaml \
--output output/go \
--generators go-http
openapi-nexus generate \
--input spec.yaml \
--output output/python \
--generators python-httpx
All nine generators, each with its own output directory:
for generator in \
typescript-fetch \
go-http \
rust-reqwest \
rust-ureq \
rust-aioduct \
python-httpx \
python-requests \
java-okhttp \
kotlin-okhttp
do
openapi-nexus generate -i spec.yaml -o "output/${generator}" -g "${generator}"
done
Configuration
Configuration is resolved with the following precedence (highest to lowest):
- Command-line arguments
- Environment variables (prefixed with
OPENAPI_NEXUS_) - Configuration file (
openapi-nexus-config.toml) - Defaults
Environment Variables
export OPENAPI_NEXUS_INPUT="spec.yaml"
export OPENAPI_NEXUS_OUTPUT="generated"
export OPENAPI_NEXUS_GENERATORS="typescript-fetch"
Configuration File
Create an openapi-nexus-config.toml in your project root. See the sample configuration file for all available options.
Generator-specific options live under [generators.<name>] sections:
[generators.go-http]
module_path = "github.com/myorg/myproject/sdk"
[generators.rust-reqwest]
crate_name = "my-api-client"
workspace_mode = true
workspace_deps = "workspace_version" # "explicit" | "workspace_version" | "full"
[generators.rust-reqwest.extra_derives.structs]
derives = ["PartialEq"]
[generators.rust-reqwest.extra_derives.enums]
derives = ["Hash"]
[generators.rust-reqwest.utoipa]
enabled = true
dependency = '{ version = "5" }'
[generators.typescript-fetch]
emit_enum_constants = true
emit_type_guards = true
property_naming = "camelCase"
CLI Reference
openapi-nexus generate --help