Skip to content

OpenAPI Guard

CLI

The openapi-guard CLI provides the same Spring Java/Kotlin and NestJS TypeScript analysis outside the editor.

npx --yes @stackblender/openapi-guard@0.2.0 .

For a repeatable project dependency:

npm install --save-dev @stackblender/openapi-guard@0.2.0
{
  "scripts": {
    "openapi:check": "openapi-guard ."
  }
}

Interface

openapi-guard [workspace] [options]

--spec <path>       Workspace-relative OpenAPI specification
--include <glob>    Source include glob; may be repeated
--exclude <glob>    Additional exclude glob; may be repeated
--implementation-path-prefix <path>
                    Prefix applied to discovered implementation routes
--format <format>   text (default) or json
-h, --help          Show help
Exit code Meaning
0 Clean
1 Contract drift found
2 Analysis or configuration failed

JSON output is a versioned report with a clean, drift, or error status. In JSON mode standard output carries only the report.

Analysis is local. The first npx or npm install contacts the npm registry to download the package; nothing else leaves the machine. Bugs: use the CLI/MCP bug form.