# @redocly/openapi-cli

> OpenAPI CLI toolbox with rich validation and bundling features.

Latest version **1.0.0-beta.95** (published 2022-05-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @redocly/openapi-cli
pnpm add @redocly/openapi-cli
yarn add @redocly/openapi-cli
bun add @redocly/openapi-cli
```

Provides the command `openapi`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0-beta.95 |
| Published | 2022-05-05 |
| First published | 2019-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 11 |
| Unpacked size | 272.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1542 |
| Maintainers | reoles, okachynskyy, viacheslavoprysk, romanhotsiy, alawar, adamaltman, marshevskyy |
| Keywords | linter, OpenAPI, Swagger, OpenAPI linter, Swagger linter, oas |

## Links

- npm: https://www.npmjs.com/package/@redocly/openapi-cli
- Repository: https://github.com/Redocly/openapi-cli
- Issues: https://github.com/Redocly/openapi-cli/issues
- npm.io page: https://npm.io/package/@redocly/openapi-cli

## Dependencies (11)

- [glob](https://npm.io/package/glob.md) ^7.1.6
- [yargs](https://npm.io/package/yargs.md) 17.0.1
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.1
- [colorette](https://npm.io/package/colorette.md) ^1.2.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.7.6
- [portfinder](https://npm.io/package/portfinder.md) ^1.0.26
- [@types/node](https://npm.io/package/@types/node.md) ^14.11.8
- [glob-promise](https://npm.io/package/glob-promise.md) ^3.4.0
- [simple-websocket](https://npm.io/package/simple-websocket.md) ^9.0.0
- [assert-node-version](https://npm.io/package/assert-node-version.md) ^1.0.3
- [@redocly/openapi-core](https://npm.io/package/@redocly/openapi-core.md) 1.0.0-beta.95

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.0.0-beta.95 (latest) — 2022-05-05
- 1.0.0-beta.31 (next) — 2021-01-25
- 1.0.0-beta.94 — 2022-04-13
- 1.0.0-beta.93 — 2022-04-05
- 1.0.0-beta.92 — 2022-04-04
- 1.0.0-beta.91 — 2022-03-29
- 1.0.0-beta.90 — 2022-03-24
- 1.0.0-beta.89 — 2022-03-21
- 1.0.0-beta.88 — 2022-03-16
- 1.0.0-beta.87 — 2022-03-10
- 1.0.0-beta.86 — 2022-03-09
- 1.0.0-beta.85 — 2022-03-02
- 1.0.0-beta.84 — 2022-02-23
- 1.0.0-beta.83 — 2022-02-22
- 1.0.0-beta.82 — 2022-02-15
- … 140 more at https://npm.io/package/@redocly/openapi-cli/versions

## README

# OpenAPI CLI toolset

OpenAPI CLI toolbox with rich validation and bundling features.

![Travis (.org)](https://img.shields.io/travis/Redocly/openapi-cli/master)
![npm (scoped)](https://img.shields.io/npm/v/@redocly/openapi-cli)
![NPM](https://img.shields.io/npm/l/@redocly/openapi-cli)

![OpenAPI 3 CLI toolset](./media/openapi-cli.gif)

## Features

Currently, @redocly/openapi-cli supports these features:

- [x] Multifile validation. No need to bundle your file before validation.
- [x] Lightning-fast validation. Lint a 1 Mb file in less than one second.
- [x] Built-in rules for common validations.
- [x] Configurable severity levels for each rule.
- [x] Human-readable error messages with codeframes and stylish format options.
- [x] Intuitive suggestions for misspelled types or references.
- [x] Easy to implement custom rules.
- [x] Bundle a multifile definition into a single file.
- [x] Decorators to modify a validated definition during bundling.
- [x] Preview reference docs for local development.
- [x] Support for OpenAPI 2 (fka Swagger) and OpenAPI 3.0.
- [ ] Support for OpenAPI 3.1 ([coming soon](https://github.com/Redocly/openapi-cli/issues/160)).

## What makes this tool different

Unlike other OpenAPI linters, `@redocly/openapi-cli` defines the possible type tree of a valid OpenAPI definition and then traverses it. This approach is very similar to how linters for programming languages work and results in major performance benefits over other approaches. Extend functionality at different points in the lifecycle with preprocessors, rules, and decorators.

## TLDR

`npx @redocly/openapi-cli lint path-to-root-file.yaml`

## [Read the docs](https://redoc.ly/docs/cli/)

## Credits

Thanks to [graphql-js](https://github.com/graphql/graphql-js) and [eslint](https://github.com/eslint/eslint) for inspiration of the definition traversal approach and to [Swagger](https://github.com/swagger-api/swagger-editor), [Spectral](https://github.com/stoplightio/spectral), and [OAS-Kit](https://github.com/Mermade/oas-kit) for inspiring the ruleset.

---
_Source: https://npm.io/package/@redocly/openapi-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
