OpenAPI 3.1 to Code Generator - Generate type-safe, production-ready code from OpenAPI specifications
OpenAPI Nexus is a modern, modular code generator that transforms OpenAPI 3.1 specifications into client or server libraries. It provides a flexible, extensible architecture for generating high-quality code across multiple languages.
- 🎯 OpenAPI 3.1 Support - Support for OpenAPI 3.1 specifications
- 🏗️ Modular Architecture - Extensible pipeline design allows easy addition of new languages and transformations
- 📦 Multi-file Output - Organized output structure with separate API, model, and runtime modules
- 🎨 Configurable - Flexible configuration via CLI, environment variables, or config files
- 🔄 Transform Pipeline - Built-in transformation passes for normalization and optimization (Working In Progress)
- 📝 Template-based - Jinja2-style templates for customizable code generation
- Download the binary from the releases page.
Generate TypeScript code from an OpenAPI specification:
openapi-nexus generate --input path/to/openapi.yaml --output generated --generator typescript-fetchOpenAPI Nexus supports multiple configuration methods with the following precedence (highest to lowest):
- Command-line arguments
- Environment variables
- Configuration file (
openapi-nexus-config.toml) - Defaults
Create an openapi-nexus-config.toml file in your project root by referencing the sample configuration file.
All configuration options can also be set via environment variables:
export OPENAPI_NEXUS_INPUT="spec.yaml"
export OPENAPI_NEXUS_OUTPUT="generated"
export OPENAPI_NEXUS_GENERATOR="typescript-fetch"
export OPENAPI_NEXUS_TS_FILE_NAMING_CONVENTION="PascalCase"openapi-nexus generate --help- ✅ TypeScript
- 🚧 Rust
- 🚧 Python
- 🚧 Go
- ...
OpenAPI Nexus follows a modular, pipeline-based architecture:
OpenAPI Spec → Parse → Transform → AST → Emit → Generated Code
- Parse - Converts OpenAPI YAML/JSON to internal representation using utoipa
- Transform - Applies extra modifications to the OpenAPI specification
- AST Generation - Converts to language-specific partial Abstract Syntax Trees
- Emission – Produces formatted source code from ASTs using a hybrid templating approach
This project is dual-licensed under either:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.