openapi-generator-cli

Generate API client SDKs, server stubs, and docs from an OpenAPI spec across 170+ languages and frameworks.

Tool
PyPI
v7.25.0
26,703stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
93/100Excellent
Development Activity96
Maintenance96
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture82
Code Quality85
Innovation75
Learning Curve90

OpenAPI Generator is a widely used code-generation engine that turns an OpenAPI (Swagger) specification into ready-to-use API client libraries, server stubs, documentation, and configuration files. The openapi-generator-cli PyPI package wraps the project’s Java-based command-line tool so Python developers can install and invoke it with pip install openapi-generator-cli instead of managing a separate Maven/JAR toolchain, downloading the matching release JAR from Maven Central automatically.

Under the hood it drives the exact same openapi-generator-cli.jar used by the npm and Homebrew distributions, exposing generate, validate, meta, author-template, and batch subcommands. With support for 170+ generator targets spanning client SDKs, server stubs, documentation formats, and schema/config files, it’s the tool teams reach for whenever they need consistent, spec-driven code generation as part of a build pipeline or local dev workflow.

What You Get

  • Python-native pip install access to the OpenAPI Generator Java CLI, with the correct release JAR fetched automatically from Maven Central at install/first-run time
  • Client SDK generation for 170+ languages and frameworks (TypeScript, Python, Java, Go, Rust, Swift, Kotlin, and more) from a single OpenAPI spec
  • Server stub generation for popular frameworks (Spring, aspnetcore, Express, and others) to bootstrap an API implementation from a spec
  • validate, meta, author-template, and batch subcommands for spec validation, scaffolding custom generators, and generating multiple targets from one config file
  • An optional jdk4py extra that installs a bundled JDK alongside the package when a system Java isn’t already available

Common Use Cases

  • Generating a typed HTTP client SDK for a Python codebase directly from a team’s OpenAPI/Swagger spec
  • Keeping client and server code in sync with an API contract by regenerating SDKs in CI whenever the spec changes
  • Producing API reference documentation (HTML, Markdown, AsciiDoc) automatically from an OpenAPI definition
  • Scaffolding a new server stub in a target framework to jump-start implementing an API described by an existing spec
  • Validating an OpenAPI spec for structural and semantic correctness before it’s published or consumed downstream

Under The Hood

Architecture The CLI is a thin airline-based command dispatcher (org.openapitools.codegen.OpenAPIGenerator) that registers subcommands — Generate, GenerateBatch, Meta, Validate, ConfigHelp, ListGenerators, AuthorTemplate, Version, CompletionCommand — under org.openapitools.codegen.cmd, each delegating into the shared openapi-generator core engine that the whole monorepo builds around (the CLI module is a thin Maven artifact, openapi-generator-cli, sitting on top of the core codegen library). The openapi-generator-cli PyPI package itself is a small Python launcher that resolves and shells out to this same JAR, so all real logic lives in the Java layer; the pip layer’s only job is dependency-free installation and JAR version tracking.

Tech Stack The CLI module is built with Maven, using airline for command/argument parsing, logback/slf4j for logging, and TestNG for its own test suite; it depends on the sibling openapi-generator Maven artifact for the actual generation engine (Mustache/Handlebars templating, Swagger/OpenAPI parsers). The Python distribution has no runtime dependencies of its own beyond a working java binary (or the optional jdk4py package), and republishes a new PyPI release automatically whenever a new version lands in Maven Central.

Code Quality The CLI module carries its own TestNG unit tests (GenerateTest, GenerateBatchTest, AuthorTemplateTest, plus option-parsing tests) and inherits the monorepo’s Checkstyle (Google style), SpotBugs, and PMD static-analysis configuration. The broader project runs well over 100 CI workflows that regenerate and rebuild sample clients/servers for essentially every supported generator target on every change, which is an unusually strong end-to-end regression net for a code generator, even though the CLI module’s own unit-test surface is comparatively small.

API Design The developer experience is deliberately minimal: one pip install, one openapi-generator-cli generate -i spec.yaml -g <generator> -o out/ invocation, with list and config-help subcommands for discovering generator names and options. The main friction point is the implicit dependency on a system Java runtime, which the jdk4py extra exists specifically to remove; documentation for exact generator options is delegated to the extensive online docs rather than exhaustive --help output.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search