$ the-wire ยท showcase
FASTAPI FIXES STREAMING SCHEMA CHAOS ACROSS 4 CRITICAL BUGS
By RepoJournal ยท Filed ยท About FastAPI & Pydantic ยท Composed from the cited sources ยท methodology
FastAPI shipped fixes for four streaming and schema generation bugs that were silently breaking OpenAPI contracts and response validation across SSE, JSONL, and typed iterables.
The most urgent: SSE and JSONL streaming endpoints were ignoring declared `status_code` parameters and `Response` modifications, always returning 200 while OpenAPI documented whatever you declared [1]. That's a contract violation that will break client code expecting a different status. Equally critical, when those same streaming routes went through `include_router()`, the schema lost all stream item type information, turning `itemSchema` into an empty object [2]. Runtime behavior stayed correct, but any client relying on the OpenAPI spec to understand what they were receiving got nothing. Beyond streaming, two more bugs hit non-streaming routes: nested `Annotated` types in sequences were crashing at startup [3], and non-generator endpoints annotated with `Iterable[T]` were dropping all `response_model_*` serialization options like `exclude_unset` and `exclude_defaults` [4]. This period saw 17 commits and 6 releases across the repo, but these four fixes are what matter.
Action items
- โ Upgrade FastAPI if you use SSE or JSONL streaming endpoints - status codes are now honored fastapi/fastapi [immediate]
- โ Regenerate OpenAPI specs for routed streaming endpoints to pick up corrected item schemas fastapi/fastapi [plan]
- โ If using nested Annotated types with Query() or Body(), upgrade to unblock startup fastapi/fastapi [immediate]
- โ Audit any Iterable[T] endpoints using response_model_exclude_* for missing serialization fastapi/fastapi [plan]
References
- [1] ๐ Fix `status_code` being ignored for SSE and JSONL streaming endpoints โ fastapi/fastapi
- [2] ๐ Fix stream item type lost when using `include_router()` โ fastapi/fastapi
- [3] ๐ Fix handling sequences with nested Annotated types โ fastapi/fastapi
- [4] ๐ Fix `response_model_*` params ignored for non-generator endpoints with `Iterable[..]` return type โ fastapi/fastapi