ibm-openapi-validator

中文文档
1.38.6发布于 2026/11/04Apache-2.0

Configurable and extensible validator/linter for OpenAPI documents

原始使用文档
文档目录4 节
  1. Installation
  2. Usage
  3. Command Syntax
  4. Further Reading

OpenAPI Validator

The IBM OpenAPI Validator lets you validate OpenAPI 3.0.x and OpenAPI 3.1.x documents for compliance with the OpenAPI specifications, as well as IBM-defined best practices.

Note: this page displays abbreviated usage info for getting started. Visit this page for the full documentation.

Installation

npm install -g ibm-openapi-validator

The -g flag installs the tool globally so that the validator can be run from anywhere in the file system. Alternatively, you can pass no flag or the --save-dev flag to add the validator as a dependency to your project and run it from your NPM scripts or JavaScript code.

Usage

Command Syntax

Usage: lint-openapi [options] [file...]

Run the validator on one or more OpenAPI 3.x documents

Options:
  -c, --config <file>            use configuration stored in <file> (*.json, *.yaml, *.js)
  -e, --errors-only              include only errors in the output and skip warnings (default is false)
  -i, --ignore <file>            avoid validating <file> (e.g. -i /dir1/ignore-file1.json --ignore /dir2/ignore-file2.yaml ...) (default is []) (default: [])
  -j, --json                     produce JSON output (default is text)
  -l, --log-level <loglevel>     set the log level for one or more loggers (e.g. -l root=info -l ibm-schema-description-exists=debug ...)  (default: [])
  -n, --no-colors                disable colorizing of the output (default is false)
  -r, --ruleset <file>           use Spectral ruleset contained in `<file>` ("default" forces use of default IBM Cloud Validation Ruleset)
  -s, --summary-only             include only the summary information and skip individual errors and warnings (default is false)
  -q, --impact-score             compute scores representing the API impact of rule violations and include with the results (default is false)
  -m, --markdown-report          generate a Markdown file with a report on all validator results (default is false)
  -w, --warnings-limit <number>  set warnings limit to <number> (default is -1)
  --version                      output the version number
  -h, --help                     display help for command

where [file...] is a space-separated list containing the filenames of one or more OpenAPI 3.x documents to be validated.

Further Reading

Again, this page displays abbreviated information. The following links may be helpful:

版本与发布记录

ibm-openapi-validator 共发布 317 个版本,首次发布于 2018/10/17;过去 12 个月发布了 22 个版本。

版本发布日期距今
1.38.6latest2026/11/041 天前
1.38.52026/11/041 天前
1.38.42026/09/181 个月前
1.38.32026/09/091 个月前
1.38.22026/08/033 个月前
1.38.12026/07/273 个月前

其他发布通道:v1-rc → 1.0.0-rc.3。

关于 ibm-openapi-validator 的常见问题

ibm-openapi-validator 是什么?

Configurable and extensible validator/linter for OpenAPI documents

如何安装 ibm-openapi-validator?

在项目目录运行 npm install ibm-openapi-validator,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 lint-openapi,可以用 npx lint-openapi 直接运行。

ibm-openapi-validator 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ibm-openapi-validator 是否存在。

ibm-openapi-validator 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=16.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

ibm-openapi-validator 可以商用吗?

ibm-openapi-validator 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

ibm-openapi-validator 还在维护吗?

最新版本 1.38.6 发布于 2026/11/04(1 天前);至今共发布 317 个版本,其中过去 12 个月发布了 22 个;首次发布于 2018/10/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。