Commands

Version: current
  • Maintained versions
  • Unmaintained versions
Edit this page

Commands

A command is provided in order to dump the documentation in json, yaml or html.

1
$ php app/console api:doc:dump [--format="..."]

The --format option allows to choose the format (default is: json).

By default, the generated JSON will be pretty-formatted. If you want to generate a json without whitespace, use the --no-pretty option.

1
2
$ php app/console api:doc:dump --format=json > json-pretty-formatted.json
$ php app/console api:doc:dump --format=json --no-pretty > json-no-pretty.json

Every format can override API url. Useful if static documentation is not hosted on API url:

1
$ php app/console api:doc:dump --format=yaml --server-url "http://example.com/api" > api.yaml

For example to generate a static version of your documentation you can use:

1
$ php app/console api:doc:dump --format=html > api.html

By default, the generated HTML will add the sandbox feature. If you want to generate a static version of your documentation without sandbox, or configure UI configuration, use the --html-config option.

  • assets_mode - `cdn` loads assets from CDN, `offline` inlines assets
  • server_url - API url, useful if static documentation is not hosted on API url
  • swagger_ui_config - configure Swagger UI
    • "supportedSubmitMethods":[] disables the sandbox
1
$ php app/console api:doc:dump --format=html --html-config '{"assets_mode":"offline","server_url":"https://example.com","swagger_ui_config":{"supportedSubmitMethods":[]}}' > api.html
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.