CLI
Run OpenAPI Guard from a terminal or in CI with the npm package.
Documentation pages
The openapi-guard CLI provides the same analysis as the VS Code extension outside the
editor: Spring Boot in Java and Kotlin, NestJS, Express, and AWS Lambda (API Gateway
routeKey dispatch) in TypeScript or JavaScript.
npx --yes @stackblender/openapi-guard@0.4.1 .
For a repeatable project dependency:
npm install --save-dev @stackblender/openapi-guard@0.4.1
{
"scripts": {
"openapi:check": "openapi-guard ."
}
}
Interface
openapi-guard [workspace] [options]
--spec <path> Workspace-relative OpenAPI specification; may be
repeated (default: every OpenAPI 3.x file found)
--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. Source it
could not analyze, such as a computed route or unrecognized routeKey dispatch, is
listed under limitations; operations that code might serve are not reported as
missing. 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.