Skip to content

Latest commit

 

History

History
61 lines (38 loc) · 1.29 KB

CLI.md

File metadata and controls

61 lines (38 loc) · 1.29 KB

Command line interface

The CLI is a thin wrapper around the library Node API. It's available with the same name of the package when installed globally:

swagger-jsdoc

Or through the standard ways provided by your package manager:

yarn swagger-jsdoc

Usage

Print the help menu:

swagger-jsdoc -h

Definition file

Set with --definition (or -d) flag:

swagger-jsdoc -d swaggerDefinition.js

Acceptable file extensions: .cjs, .json, .yml, .yaml.

Input files

Set through arguments.

One by one:

swagger-jsdoc -d swaggerDefinition.cjs route1.js route2.js component1.yaml component2.yaml

Multiple with a pattern:

swagger-jsdoc -d swaggerDefinition.cjs route*.js component*.yaml

Glob patterns are acceptable to match multiple files with same extension *.js, *.php, etc. or patterns selecting files in nested folders as **/*.js, **/*.php, etc.

Paths are relative to the current working directory.

Output file (optional)

The output is swagger.json by default, but can be changed:

swagger-jsdoc -d swaggerDefinition.cjs route1.js -o my_spec.json

When output file extension is .yaml or .yml, the specification will be parsed and saved in YAML format.