OpenAPI Generator CLI
$ openapi-generator-cli Foundation Low RiskOpenAPI Generator CLI (@openapitools/openapi-generator-cli) wraps the Java OpenAPI Generator JAR to validate OpenAPI 2.0/3.x specs and generate SDKs, server stubs, or HTML/Markdown API documentation across dozens of languages. Deterministic config files (openapitools.json) aid repeatability, though the JVM + npm wrapper startup is heavy.
brew install openapi-generator openapi-generator-cli runs deterministic local codegen over repository OpenAPI files and writes generated SDKs directly to disk.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports validate, --dry-run, openapitools.json pinning, and non-interactive -i/-g/-o flags, though stdout is verbose Java logging.
validateand--dry-runflags prevent unwanted file writes- Deterministic
openapitools.jsonconfig
Offline spec validation and isolated -o output directory keep risks low (note first run may fetch JAR from Maven Central if uncached).
- Supports
--dry-runpreview mode .openapi-generator-ignoreprotects hand-edited files
Requires both Node.js (for @openapitools/openapi-generator-cli wrapper) and a Java Runtime Environment (JRE) to execute the JAR.
- Dual Node.js + Java runtime requirement (or Docker image)
Unmatched breadth of 50+ target SDK languages and documentation generators from a single OpenAPI spec.
- Generates TypeScript, Python, Go, Rust, Java, and HTML/Markdown docs
OpenAPITools Foundation project (OpenAPITools/openapi-generator-cli) under Apache-2.0.
- Broad multi-company open-source governance
Extensive docs on openapi-generator.tech, though generator-specific --additional-properties vary widely.
- Official docs at openapi-generator.tech/docs/usage/
Security, Auth & Guardrails
No credentials required for local spec validation/generation; downloads generator JARs over HTTPS on first run unless cached.
Free open-source software (Apache-2.0).
# OpenAPI Generator CLI Agent Rules - Run `openapi-generator-cli validate -i <spec>` before generating any SDK or docs. - Test generation with `--dry-run` or write into a clean `-o` subdirectory rather than mixing with hand-written code. - Pin generator version in `openapitools.json` to avoid unexpected JAR downloads.
Agent-Ready Command Recipes
Safe Read-Only Queries
openapi-generator-cli validate -i openapi.yaml
Validates OpenAPI 2.0/3.x syntax and schema references without generating files.
openapi-generator-cli list
Enumerates all supported client, server, schema, and documentation generator names.
Controlled Writes & Previews
openapi-generator-cli generate -i openapi.yaml -g typescript-fetch -o ./generated-sdk --dry-run
Previews which SDK files would be generated without writing changes to ./generated-sdk.
Strengths for Agents
- + Supports
validateand--dry-runbefore writing generated SDK files. - + Covers 50+ client, server, schema, and documentation targets from one OpenAPI file.
- + Pinning versions via
openapitools.jsonkeeps team and agent codegen reproducible.
Caveats & Pitfalls
- ! Requires Java (JRE) in addition to Node.js when using the npm CLI wrapper, plus Maven JAR downloads on first run.
- ! Verbose JVM stdout and inconsistent
--additional-propertiesacross language generators.