Redocly OpenAPI CLI is an open source command-line tool used to:
- Lint and bundle your OpenAPI definition(s).
- Decorate your APIs (add or remove data)
- Preview reference docs for local development.
- Split single-file OpenAPI files into a multi-file format (coming soon).
- Integrate with Redocly's API registry (coming soon).
- Build production-ready reference docs (requires an Enterprise license key).
Redocly OpenAPI CLI does not:
- Integrate to Redocly's API Registry (instead, integrate by connecting to your source control or upload file or URL).
- Structure your OpenAPI repository (see create OpenAPI repo).
Redocly OpenAPI CLI can be:
- Extended by writing custom rules and decorators.
Currently, @redocly/openapi-cli supports these features:
- Multifile validation. No need to bundle your file before validation.
- Support for remote
- Configurable severity levels for each rule. You can tailor your experience with @redocly/openapi-cli as you wish.
- Lightning-fast validation. Check 1 Mb file in less than one second.
- Human-readable error messages. Now with stacktraces and codeframes.
- Intuitive suggestions for misspelled types or references.
- Easy to implement custom rules. Need something? Ask us or do it yourself.
- Bundle a multifile definition into a single file.
- Preview reference docs.
- Supports OAS 3.0 and Swagger 2 (OAS 3.1 is coming soon).
Unlike other OpenAPI validators, @redocly/openapi-cli defines the possible type tree of a valid OpenAPI definition and then traverses it. This approach is very similar to how compilers work and results in major performance benefits over other approaches.
Additionally, you may extend functionality by adding additional rules. Both the lint and the bundler features are following the visitor pattern for adding custom behavior on the parsed object.
@redocly/openapi-cli either with
npx or after installing it locally.
npx, enter the following:
npx @redocly/openapi-cli <command> [options]
Otherwise, install the
npm install -g @redocly/openapi-cli
yarn global add @redocly/openapi-cli
openapi -h to confirm the installation was successful (you'll see the usage information).
See the source in the OpenAPI-CLI GitHub repository.