Browse Source
When SSE/JSONL endpoints are defined on an APIRouter and included via include_router(), the stream_item_type and stream_item_field attributes were dropped because the detection in APIRoute.__init__ only runs when response_model is a DefaultPlaceholder — but include_router passes the already-resolved value. After add_api_route, copy both stream_item_type and stream_item_field from the original route, then re-bake self.app so the handler closure captures the correct stream_item_field for runtime validation. Without re-baking, both runtime validation and OpenAPI schema generation remain broken because: - get_route_handler() closes over stream_item_field at __init__ time - openapi/utils.py reads stream_item_field, not stream_item_typepull/15426/head
2 changed files with 116 additions and 0 deletions
Loading…
Reference in new issue