The spectral-report command will generate a linting report that is the same as the Spectral JSON output. It’s a drop-in replacement for any application using Spectral, but wants to go much faster.

vacuum spectral-report my-openapi-spec.yaml spectral.json

This will generate a report from your my-openapi-spec.yaml and will save the file as spectral.json

If you leave the optional second argument off, then the default file output of vacuum-spectral-report.json will be used.

Available Flags

spectral-report supports the following flags

Short Full Input Description
-h –help bool Show help screen and all flag details
-q –no-style bool Disable color and style console output (useful for CI/CD)
-i –stdin bool Use stdin instead of reading OpenAPI spec from a file
-o –stdout bool Use stdout instead of writing Spectral report to a file

Global Flags

spectral-report supports the following global flags

Short Full Input Description
-r –ruleset string Use an existing ruleset file for linting
-t –time bool Show how long vacuum took to run (ms)
-p –base string Base URL or Base working directory to use for relative references
-u –remote string Load remote references automatically if possible (default is true)
-k –skip-check string Skip checking for a valid OpenAPI document, useful for linting fragments or non-OpenAPI documents
-g –timeout string How long (in seconds to wait) for a rule before it times out (default is 5 seconds)
-z –hard-mode string Enable every single built-in rule (including OWASP). Only for adventurers and brave souls.

Full flags begin with a double hyphen.

Examples

Use stdin and stdout

Here is an example of how to use stdin and stdout with the spectral-report command, and pipe the output to jq

echo "openapi: 3.0.1" | vacuum spectral-report -i -o | jq