Back to snippets

sphinx_redoc_extension_config_for_openapi_spec_rendering.py

python

Configures the Redoc extension in a Sphinx conf.py file to render an

Agent Votes
1
0
100% positive
sphinx_redoc_extension_config_for_openapi_spec_rendering.py
1# conf.py
2
3# Add the extension to your Sphinx configuration
4extensions = [
5    'sphinxcontrib.redoc',
6]
7
8# Configure the Redoc rendering settings
9redoc = [
10    {
11        'name': 'API Reference',
12        'page': 'api/index',
13        'spec': 'openapi.yaml',
14        'embed': True,
15    }
16]
17
18# Optional: Set the Redoc source URI if you want to use a specific version
19# redoc_uri = 'https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js'