Generate and return the HTML response that loads ReDoc for the alternative API docs (normally served at `/redoc`). You would only call this function yourself if you needed to override some parts, for example the URLs to use to load ReDoc's JavaScript and CSS. Read more about i
(
*,
openapi_url: Annotated[
str,
Doc(
"""
The OpenAPI URL that ReDoc should load and use.
This is normally done automatically by FastAPI using the default URL
`/openapi.json`.
Read more about it in the
[FastAPI docs for Conditional OpenAPI](https://fastapi.tiangolo.com/how-to/conditional-openapi/#conditional-openapi-from-settings-and-env-vars)
"""
),
],
title: Annotated[
str,
Doc(
"""
The HTML `<title>` content, normally shown in the browser tab.
Read more about it in the
[FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/)
"""
),
],
redoc_js_url: Annotated[
str,
Doc(
"""
The URL to use to load the ReDoc JavaScript.
It is normally set to a CDN URL.
Read more about it in the
[FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/)
"""
),
] = "https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js",
redoc_favicon_url: Annotated[
str,
Doc(
"""
The URL of the favicon to use. It is normally shown in the browser tab.
"""
),
] = "https://fastapi.tiangolo.com/img/favicon.png",
with_google_fonts: Annotated[
bool,
Doc(
"""
Load and use Google Fonts.
"""
),
] = True,
)
| 195 | |
| 196 | |
| 197 | def get_redoc_html( |
| 198 | *, |
| 199 | openapi_url: Annotated[ |
| 200 | str, |
| 201 | Doc( |
| 202 | """ |
| 203 | The OpenAPI URL that ReDoc should load and use. |
| 204 | |
| 205 | This is normally done automatically by FastAPI using the default URL |
| 206 | `/openapi.json`. |
| 207 | |
| 208 | Read more about it in the |
| 209 | [FastAPI docs for Conditional OpenAPI](https://fastapi.tiangolo.com/how-to/conditional-openapi/#conditional-openapi-from-settings-and-env-vars) |
| 210 | """ |
| 211 | ), |
| 212 | ], |
| 213 | title: Annotated[ |
| 214 | str, |
| 215 | Doc( |
| 216 | """ |
| 217 | The HTML `<title>` content, normally shown in the browser tab. |
| 218 | |
| 219 | Read more about it in the |
| 220 | [FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/) |
| 221 | """ |
| 222 | ), |
| 223 | ], |
| 224 | redoc_js_url: Annotated[ |
| 225 | str, |
| 226 | Doc( |
| 227 | """ |
| 228 | The URL to use to load the ReDoc JavaScript. |
| 229 | |
| 230 | It is normally set to a CDN URL. |
| 231 | |
| 232 | Read more about it in the |
| 233 | [FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/) |
| 234 | """ |
| 235 | ), |
| 236 | ] = "https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js", |
| 237 | redoc_favicon_url: Annotated[ |
| 238 | str, |
| 239 | Doc( |
| 240 | """ |
| 241 | The URL of the favicon to use. It is normally shown in the browser tab. |
| 242 | """ |
| 243 | ), |
| 244 | ] = "https://fastapi.tiangolo.com/img/favicon.png", |
| 245 | with_google_fonts: Annotated[ |
| 246 | bool, |
| 247 | Doc( |
| 248 | """ |
| 249 | Load and use Google Fonts. |
| 250 | """ |
| 251 | ), |
| 252 | ] = True, |
| 253 | ) -> HTMLResponse: |
| 254 | """ |
no outgoing calls
searching dependent graphs…