The Wire · Showcase
FASTAPI DITCHES DEPENDENCY FLATTENING, CUTS OPENAPI GENERATION BLOAT
By RepoJournal · Filed · About FastAPI & Pydantic
FastAPI is ripping out the dependency tree flattening that bloated OpenAPI schema generation, replacing it with direct graph traversal that preserves order and skips duplicates without the synthetic overhead.
Tiangolo shipped the one-two punch this cycle: benchmarks first [1], then the refactor [2]. The old code built massive synthetic dependency trees just to extract parameter and security metadata for OpenAPI, then threw them away. The new approach walks each route's dependency graph directly, collecting only what OpenAPI actually needs. Duplicate skipping and OAuth scope inheritance work without the extra object churn. On the back of this, the lru_cache for dependency resolution bumped up [3] to handle apps with more than 1024 dependencies, a problem real users hit. Memory profiling infrastructure landed too [4], so regressions get caught early. Over in SQLModel, the latest-changes action upgraded [5] to 0.7.1, cleaning up redundant workflow config. Pydantic's crew fixed URL comparison semantics [6] to return NotImplemented instead of False when comparing different types, which was breaking sort order logic. Annotation access in Python 3.13 got patched [8], and grammar fixes landed in ValidationError JSON [7], [9].
One email a day. Unsubscribe in one click.
Keep up with FastAPI & Pydantic in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Watch FastAPI 0.115+ for the OpenAPI generation speedup; profile your app if you have complex dependency chains fastapi/fastapi [monitor]
- → Review Pydantic URL comparisons if you rely on sort order or ordering logic with different URL types pydantic/pydantic [plan]
- → Update SQLModel workflows to use latest-changes 0.7.1 if you maintain CI release automation tiangolo/sqlmodel [plan]
References
- [1] 👷 Add OpenAPI dependency benchmarks ↗ fastapi/fastapi
- [2] ⚡️ Avoid flattening dependencies for OpenAPI ↗ fastapi/fastapi
- [3] ♻️ Update the lru_cache limit for dependencies to account for large apps ↗ fastapi/fastapi
- [4] 👷 Add new memory benchmark ↗ fastapi/fastapi
- [5] ⬆️ Upgrade latest-changes to 0.7.1 ↗ tiangolo/sqlmodel
- [6] Return `NotImplemented` from URL ordering comparisons with foreign types ↗ pydantic/pydantic
- [7] Fix grammar in ValidationError JSON description (#13531) pydantic/pydantic
- [8] Fix access of annotations in `safe_get_annotations()` in Python <= 3.13 (#13521) pydantic/pydantic
- [9] Fix grammar in ValidationError JSON description ↗ pydantic/pydantic