CLI Options
Complete reference for all command-line interface options.
Usage
CLI
npx openapi-format <input-file> -o [output-file] [options]
Arguments:
input-file the OpenAPI document (local or remote, JSON or YAML)
output-file optional output file (.json or .yaml)
Options:
--output, -o Save formatted file as JSON/YAML [path]
--sortFile Custom field ordering file [path]
--casingFile Casing rules file [path]
--generateFile Generate rules file [path]
--filterFile Filter rules file [path]
--overlayFile OpenAPI overlay actions file [path]
--no-sort Don't sort the OpenAPI file [boolean]
--keepComments Keep YAML comments [boolean]
--sortComponentsFile Components to sort alphabetically [path]
--sortComponentsProps Sort schema properties alphabetically [boolean]
--no-bundle Don't bundle $ref references [boolean]
--split Split into multi-file structure [boolean]
--rename Rename the OpenAPI title [string]
--convertTo Convert to OpenAPI version 3.1 or 3.2 [string]
--configFile Config file with all CLI options [path]
--lineWidth Max line width of YAML output [number]
--json Output as JSON to stdout [boolean]
--yaml Output as YAML to stdout [boolean]
--playground, -p Open config in online playground
--help Show help [boolean]
--version Output version number
--verbose Increase output verbosity [count]Options Reference
| Parameter | Alias | Description | Default |
|---|---|---|---|
| --output | -o | Save formatted OpenAPI file | |
| --sortFile | -s | Custom field ordering file | defaultSort.json |
| --filterFile | -f | Filter settings file | |
| --casingFile | -k | Casing rules file | |
| --generateFile | -g | Generate rules file | |
| --overlayFile | -l | OpenAPI overlay actions file | |
| --no-sort | Don't sort the file | false | |
| --keepComments | Keep YAML comments | false | |
| --sortComponentsFile | Sort components alphabetically | ||
| --sortComponentsProps | Sort schema properties alphabetically | false | |
| --no-bundle | Don't bundle $ref references | false | |
| --split | Split into multi-file structure | false | |
| --rename | Rename the OpenAPI title | ||
| --convertTo | Convert to OpenAPI 3.1 or 3.2 | ||
| --configFile | -c | Config file with all options | |
| --lineWidth | Max YAML line width | -1 (∞) | |
| --json | Output as JSON to stdout | false | |
| --yaml | Output as YAML to stdout | false | |
| --verbose | -v | Increase verbosity |