tezvyn:

Customizing FastAPI's Swagger UI Behavior

Source: fastapi.tiangolo.comadvanced

Treat FastAPI's Swagger UI as a configurable frontend, not a static page. You can customize its behavior by passing a dictionary of settings on app startup. This is useful for changing themes or pre-filling auth fields. The footgun: keys must be camelCase.

Treat FastAPI's Swagger UI as a configurable frontend, not a static page. You customize it by passing a dictionary to the `swagger_ui_parameters` argument when creating your `FastAPI` app. This allows you to change themes, disable syntax highlighting for performance, or control how models are expanded by default. The footgun: parameter keys must be the exact camelCase strings the Swagger UI JavaScript library expects, not Pythonic snake_case, or they will be silently ignored.

Read the original → fastapi.tiangolo.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Customizing FastAPI's Swagger UI Behavior · Tezvyn