Create, run, and manage Swagger projects from the command line.
Options:
- -h, --help: Outputs usage information.
- -V, --version: Outputs the swagger cli version number.
Example:
swagger -V
0.2.0
Creates a folder with the specified [name] containing a new Swagger project. A project skeleton is downloaded from GitHub and installed in the new folder.
Options:
- -h, --help: Outputs usage information.
- -f, --framework : Specifies an API framework to use with the project. Choices are connect, express, hapi, restify, or sails.
Example:
swagger project create -f express sn-express
ls sn-express
README.md api app.js config node_modules package.json test
Starts the Swagger project in the current (or specified) directory. The server automatically restarts when you make changes to the project. You can also force a restart by typing rs
on the server command line.
Options:
- -h, --help: Outputs usage information.
- -d, --debug : Start in remote debug mode so you can connect to it with a debugger.
- -b, --debug-brk : Start in remote debug mode, wait for debugger.
- -m, --mock: Start in mock mode. For more information, see Running in mock mode.
- -o, --open: Open the default browser as a client to the project.
Example:
cd ./myproject
swagger -m project start
Verifies that the project in the current (or specified) directory is correct. Reports errors and warnings from the Swagger model, project configuration, etc.
Options:
- -h, --help: Outputs usage information.
- -j, --json: Output information in JSON format.
Example:
cd ./myproject
swagger project verify
Project Errors
--------------
#/: Missing required property: paths
#/: Additional properties not allowed: aths
Results: 2 errors, 0 warnings
Opens the project in the current (or specified) directory in the Swagger Editor.
Options:
- -h, --help: Outputs usage information.
- -s, --silent: Do not open the browser.
- --host : The hostname the editor is served from (default: 127.0.0.1).
- -p, --port : The port the editor is served from (default: random port).
Example:
cd ./myproject
swagger project edit
Opens the browser as a client to the current or specified project.
Options:
- -h, --help: Outputs usage information.
Example:
swagger project open ./myproject
Runs project tests.
Options:
- -h, --help: Outputs usage information.
- -d, --debug : Start in remote debug mode so you can connect to it with a debugger.
- -b, --debug-brk : Start in remote debug mode, wait for debugger.
- -m, --mock: Start in mock mode. For more information, see Running in mock mode.
Example:
`swagger project test`
controllers
hello_world
GET /hello
✓ should return a default string
✓ should accept a name parameter
2 passing (27ms)
Opens the Swagger 2.0 specification in your browser.
Example:
swagger docs