To include swagger ui javascript interface in a page you can use the swagger_ui
or swagger_ui_advanced
tags, eg:
1 | --- |
The location of swagger file (
<swagger_path>
) can be a local file path or a URL.
Use
swagger_ui_advanced
when you want to pass configuration options that will override the global configuration (see Configuration).
The<options>
value must be a valid JSON.
Examples
With a local path:
1
{% swagger_ui ./petstore.yaml %}
With a URL:
1
{% swagger_ui https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/petstore.json %}
With options:
1 | {% swagger_ui_advanced ./petstore.yaml %} |
Adjust swagger-ui behavior by updating your _config.yml
, below all the default values:
1 | theme_config: |
Be aware that “permalinks” will work as expected if the specification’s operations are defining the
operationId
key