OpenAPI验证器
IBM OpenAPI Validator允许您进行验证 OpenAPI 3.0.x 和 OpenAPI里 遵循OpenAPI规范的文档,以及ibm定义的最佳实践。
注意:本页显示用于入门的缩略用法信息。访问 这个页面 获取完整文档。
安装
npm install -g ibm-openapi-validator
这个 -g Flag全局安装该工具,以便验证器可以从文件系统中的任何位置运行。或者,您可以不传递标志或 --save-dev 标志将验证器作为一个依赖项添加到你的项目中,并从你的NPM脚本或JavaScript代码中运行它。
用法
命令语法
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
在 [file...] 是一个空格分隔的列表,包含一个或多个OpenAPI 3的文件名。需要验证的X个文档。
进一步的阅读
同样,这个页面显示了缩略信息。以下连结可能会有所帮助: