FastAPI includes some default configuration parameters appropriate for most of the use cases.
It includes these default configurations:
swagger_ui_default_parameters:Annotated[Dict[str,Any],Doc(""" Default configurations for Swagger UI. You can use it as a template to add any other configurations needed. """),]={"dom_id":"#swagger-ui","layout":"BaseLayout","deepLinking":True,"showExtensions":True,"showCommonExtensions":True,}
You can override any of them by setting a different value in the argument swagger_ui_parameters.
For example, to disable deepLinking you could pass these settings to swagger_ui_parameters:
These are JavaScript objects, not strings, so you can't pass them from Python code directly.
If you need to use JavaScript-only configurations like those, you can use one of the methods above. Override all the Swagger UI path operation and manually write any JavaScript you need.