← fastapi/fastapi
CodeVetter · Repo Unpack · Extension points

fastapi/fastapi

Scanned commit 50113da16f dated 2026-09-01 — last upstream commit. Generated by codevetter codevetter 1.12.0 on 2026-09-22. Deep analysis by claude-opus-5 via the claude CLI on 2026-09-22 (413s).

FastAPI's extension model is almost entirely composition and subclassing rather than registries. The three canonical hooks are `route_class` on `APIRouter` (swap `APIRoute` for a subclass overriding `get_route_handler`), `dependency_overrides` (a dict keyed by the original callable), and `exception_handlers` (a dict keyed by exception type or status code). Beyond those, `SecurityBase` is the contract for new auth schemes, `generate_unique_id_function` controls operation IDs for client generators, `default_response_class` and `response_class` control output encoding, and `openapi_extra` plus overriding `app.openapi()` let you post-process the schema. The `DefaultPlaceholder`/`Default()` sentinel is the mechanism that lets app → router → route parameter inheritance distinguish 'not set' from 'explicitly set to the default value'.