Migrating to FastAPI 0.137.0
Version 0.137.0 introduces 2 breaking changes. This guide details how to update your code.
Released: 6/14/2026
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
APIRouterAPIRouteBreaking Changes
●Issue #1
The structure of `router.routes` has changed from a plain list of `APIRoute` objects to potentially containing intermediate metadata objects that form a tree structure when routers are included. Any logic that iterated directly over `router.routes` expecting only `APIRoute` objects or modifying them will be affected and must be updated to handle the new tree structure or use appropriate methods to access the final routes.
●Issue #2
Logic that relied on iterating on `router.routes` directly to extract data will fail or yield incomplete results because it will encounter new internal objects instead of just `APIRoute` instances.
Migration Steps
- 1Review any code that iterates over or modifies `router.routes` directly and adapt it to handle the new tree structure or use alternative methods to access the final route definitions.
Release Summary
This release refactors the internal handling of `APIRouter` inclusion to preserve route instances instead of cloning them, enabling new features like adding routes after inclusion. This change modifies the structure of `router.routes`, which is a breaking change for code relying on its previous list structure.
Need More Details?
View the full release notes and all changes for FastAPI 0.137.0.
View Full Changelog