If the module is installed globally, a command line helper $ swagger-jsdoc
will be available.
Otherwise ./bin/swagger-jsdoc
has access to the same interface.
The easiest way to get started is using the help menu.
$ swagger-jsdoc -h
Swagger-jsdoc will read the apis
array in your definition file by default for file paths it should read.
$ swagger-jsdoc -d swaggerDef.js -o doc.json
This could be any .js or .json file which will be require()
-ed and parsed/validated as JSON.
$ swagger-jsdoc route1.js route2.js
Free form input, can be before or after definition. 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.
$ swagger-jsdoc -o custom_specification.json
swagger.json
by default. Output specification can accept also a .yaml
or .yml
. This generated OpenAPI specification can then be further tweaked with swagger-editor
or similar.