Skip to content

This module provides scripts tto help generate swagger documentation.

Functions
  • get_swagger_ui_html(openapi_spec, title, swagger_js_url, swagger_css_url, swagger_favicon_url) (HTMLResponse) A tweaked on fastapi.openapi.docs.get_swagger_ui_html to generate from raw JSON as opposed to using a url.</>
function

handler.server.utils.swagger.get_swagger_ui_html(openapi_spec, title, swagger_js_url='https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-bundle.js', swagger_css_url='https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui.css', swagger_favicon_url='https://raw.githubusercontent.com/openfaas/docs/master/docs/images/favicon.ico')

A tweaked on fastapi.openapi.docs.get_swagger_ui_html to generate from raw JSON as opposed to using a url.

Parameters
  • openapi_spec (str) OpenAPI speficication JSON encoded as string.
  • title (str) Title of the page.
  • swagger_js_url (str) Custom Javascript URL.
  • swagger_css_url (str) Custom CSS URL.
  • swagger_favicon_url (str) Custom favicon URL.
Returns (HTMLResponse)

Renderized documentation page as HTML.