Configurable and extensible validator/linter for OpenAPI documents
Note: this page displays abbreviated usage info for getting started. Visit this page for the full documentation.
npm install -g ibm-openapi-validatorThe -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.
bash
Usage: lint-openapi [options] [file...]Run the validator on one or more OpenAPI 3.x documents
Options:
-c, --config use configuration stored in (.json, .yaml, *.js)
-e, --errors-only include only errors in the output and skip warnings (default is false)
-i, --ignore avoid validating (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 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 use Spectral ruleset contained in
("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 set warnings limit to (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:- Detailed information about the configuration options
- Detailed information about the default ruleset
- Detailed information about the
--impact-score` feature