Bundle and validate OpenAPI files into one publishable spec with swagger-cli
Resolve multi-file OpenAPI definitions into one validated artifact before docs, code generation, or CI gates depend on the spec.
Prerequisites
Node.js, npm or npx, and one or more Swagger/OpenAPI JSON or YAML files with local or remote $ref targets as needed
Installation
Use the upstream install or setup path that matches your environment:
- npm install -g @apidevtools/swagger-cli
- git clone https://github.com/APIDevTools/swagger-cli.git
- npm install
- npm test
Requirements and caveats from upstream:
- There is a useful Python tool called pre-commit that can be used to execute a wide suite of pre-commit checks. The swagger-cli validate command can be integrated as part of a git pre-commit...
Basic usage or getting-started notes:
-
bash
-
swagger-cli [options]
-
Extracted from upstream docs: https://raw.githubusercontent.com/APIDevTools/swagger-cli/HEAD/README.md