🐛 Fix stream item type lost when using include_router() - #15077
Conversation
include_router()
YuriiMotov
left a comment
There was a problem hiding this comment.
LGTM in general!
@alex-raw, thank you for reporting this and working on this!
The logic around stream_item_type looks a bit fragile to me..
If response_class is set in parent router or app, then self.stream_item_type will be calculated and stored, but not used in some cases (if response class is neither DefaultPlaceholder nor EventSourceResponse).
I didn't manage to come up with particular cases, but this separation of logic seems to be error-prone (or, at least prone to confusion).
It all seem to work well now, but to prevent breaking this in the future, I suggest we add tests with default_response_class being specified for router, parent router or app.
@alex-raw, what do you think?
| @router.get("/events-jsonl") | ||
| async def stream_events_jsonl() -> AsyncIterable[Item]: | ||
| for item in items: | ||
| yield item |
There was a problem hiding this comment.
This is not SSE. So, we should probably move it to another module (test_stream_json_lines ?)
There was a problem hiding this comment.
Moved to test_stream_bare_type.py. Also added default_response_class tests for both app-level and parent router cases.
alex-raw
left a comment
There was a problem hiding this comment.
Thanks for the review!
Good point about the JSONL test, I'll move it out of test_sse.py. Where would you prefer it? I was thinking maybe test_stream_bare_type.py since it already covers JSONL edge cases, but happy to put it wherever fits best.
Will also add tests for the default_response_class edge case.
aedfba6 to
0730499
Compare
This comment was marked as resolved.
This comment was marked as resolved.
When a typed SSE or JSONL streaming endpoint is registered via a router, the OpenAPI schema loses the stream item type because include_router() re-creates routes via add_api_route() without passing stream_item_type. This fix threads stream_item_type through add_api_route() and include_router(), following the strict_content_type pattern. Fixes fastapi#15077
YuriiMotov
left a comment
There was a problem hiding this comment.
Added a couple of minor suggestions, but it looks good in general!
Will pass it to Sebastian.
@alex-raw, thanks!
| with TestClient(default_app_app) as c: | ||
| response = c.get("/api/stream") |
There was a problem hiding this comment.
I would rename c to client here and in other test functions.
Also, you can actually get OpenAPI schema directly as default_app_app.openapi()
|
|
||
| @default_app_router.get("/stream") | ||
| async def default_app_stream() -> AsyncIterable[Item]: | ||
| yield items[0] |
There was a problem hiding this comment.
Maybe better make it return the same as stream_events_typed above for consistency.
And the same for default_parent_stream.
But not critical for me
There was a problem hiding this comment.
Good point, updated both.
0730499 to
e6f376d
Compare
|
facing this issue, would appreciate merging/moving forward to remove current workarounds in my project:) what is missing/what is the expected timeline here? |
|
I tested this locally from Alex' branch, and it worked. |
|
Can confirm that applying the patches to The only other quirk (which is probably outside the scope of this PR) is that itemSchema is new in OpenAPI version 3.2: https://learn.openapis.org/specification/media-types.html . Neither of the built-in doc tools support it yet, and FastAPI also claims it's returning schema version 3.1.0 . |
|
This pull request has a merge conflict that needs to be resolved. |
Propagate stream_item_type through add_api_route so that include_router preserves the already-computed stream item type for SSE and JSONL endpoints.
Propagate stream_item_type through add_api_route so that include_router preserves the already-computed stream item type for SSE and JSONL endpoints.
e6f376d to
d8c187a
Compare
|
Confirming this on a real project (bulk NDJSON
for JSONL, generator endpoints the runtime serialization is affected too. Once the route goes through It's the same root cause this PR targets: through Minimal example - the same generator route added directly on the app vs. via from collections.abc import Iterable
from fastapi import FastAPI, APIRouter
from fastapi.testclient import TestClient
from pydantic import BaseModel
class Row(BaseModel):
id: int
name: str
optional: str | None = None # unset -> None, exercises exclude_none
def gen() -> Iterable[Row]:
yield Row(id=1, name="a")
# (A) route added directly on the app
app_a = FastAPI()
app_a.get("/direct", response_model_exclude_none=True)(gen)
# (B) same route via include_router
router = APIRouter()
router.get("/inc", response_model_exclude_none=True)(gen)
app_b = FastAPI()
app_b.include_router(router, prefix="/api")
for name, app, path in [("DIRECT", app_a, "/direct"), ("INCLUDE_ROUTER", app_b, "/api/inc")]:
body = TestClient(app).get(path).text.strip()
item = app.openapi()["paths"][path]["get"]["responses"]["200"] \
.get("content", {}).get("application/jsonl", {}).get("itemSchema", "MISSING")
print(f"{name:14s} excludes_null={'optional' not in body!s:5s} itemSchema={item}")Output - identical on 0.138.2 and 0.139.2: DIRECT excludes_null=True itemSchema={'$ref': '#/components/schemas/Row'}
INCLUDE_ROUTER excludes_null=False itemSchema={}So propagating Related: #15401 (SSE schema), #15093 / #15089 ( |
|
Great, thank you @alex-raw! 🚀 Thanks @YuriiMotov for the review and handling, and thanks @NathanCummings for the extra case, added it to the tests. Thanks all for checking and verifying it works! This will be available in FastAPI 0.140.8 in the next few hours. 🎉 |
|
Just to confirm what @LordGaav wrote above While the data is now correct in the OpenAPI schema, neither Swagger nor ReDoc are showing anything apart from the media type. Is there an issue already to update Swagger / ReDoc? |
Thanks! We are tracking this internally |
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [celery-types](https://github.com/sbdchd/celery-types) | dependencies | minor | `0.24.0` → `0.26.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/sbdchd/celery-types) |
| [elasticsearch](https://github.com/elastic/elasticsearch-py) | dependencies | minor | `9.2.1` → `9.4.1` | [](https://securityscorecards.dev/viewer/?uri=github.com/elastic/elasticsearch-py) |
| [fastapi](https://github.com/fastapi/fastapi) ([changelog](https://fastapi.tiangolo.com/release-notes/)) | dependencies | minor | `0.128.8` → `0.141.1` | [](https://securityscorecards.dev/viewer/?uri=github.com/fastapi/fastapi) |
| [fastapi](https://github.com/fastapi/fastapi) ([changelog](https://fastapi.tiangolo.com/release-notes/)) | dependencies | minor | `^0.128.0` → `^0.141.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/fastapi/fastapi) |
| [gotenberg-client](https://github.com/stumpylog/gotenberg-client) ([changelog](https://github.com/stumpylog/gotenberg-client/blob/main/CHANGELOG.md)) | dependencies | minor | `^0.13.1` → `^0.14.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/stumpylog/gotenberg-client) |
| [openai](https://github.com/openai/openai-python) | dependencies | minor | `1.72.0` → `1.109.1` | [](https://securityscorecards.dev/viewer/?uri=github.com/openai/openai-python) |
| [prometheus-client](https://github.com/prometheus/client_python) | dependencies | minor | `^0.24.1` → `^0.26.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/prometheus/client_python) |
| [redis](https://github.com/redis/redis-py) ([changelog](https://github.com/redis/redis-py/releases)) | dependencies | minor | `5.2.1` → `5.3.1` | [](https://securityscorecards.dev/viewer/?uri=github.com/redis/redis-py) |
| [requests](https://github.com/psf/requests) ([changelog](https://github.com/psf/requests/blob/master/HISTORY.md)) | dependencies | minor | `2.32.5` → `2.34.2` | [](https://securityscorecards.dev/viewer/?uri=github.com/psf/requests) |
| [scikit-learn](https://github.com/scikit-learn/scikit-learn) ([changelog](https://scikit-learn.org/stable/whats_new)) | dependencies | minor | `1.8.0` → `1.9.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/scikit-learn/scikit-learn) |
| [scipy](https://github.com/scipy/scipy) | dependencies | minor | `1.17.1` → `1.18.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/scipy/scipy) |
| [types-requests](https://github.com/python/typeshed) ([changelog](https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/requests.md)) | dependencies | minor | `2.32.4.20260324` → `2.33.0.20260712` | [](https://securityscorecards.dev/viewer/?uri=github.com/python/typeshed) |
| [uvicorn](https://github.com/Kludex/uvicorn) ([changelog](https://uvicorn.dev/release-notes)) | dependencies | minor | `^0.40.0` → `^0.52.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/Kludex/uvicorn) |
| [wand](http://wand-py.org/) ([source](https://github.com/emcconville/wand), [changelog](https://docs.wand-py.org/en/latest/changes.html)) | dependencies | minor | `^0.6.13` → `^0.7.0` | [](https://securityscorecards.dev/viewer/?uri=github.com/emcconville/wand) |
---
### Release Notes
<details>
<summary>elastic/elasticsearch-py (elasticsearch)</summary>
### [`v9.4.1`](https://github.com/elastic/elasticsearch-py/releases/tag/v9.4.1): 9.4.1
[Compare Source](https://github.com/elastic/elasticsearch-py/compare/v9.4.0...v9.4.1)
Enhancements
- Optional backoff delay strategy for retries (Fixes [#​197](https://github.com/elastic/elasticsearch-py/issues/197)) ([#​3430](https://github.com/elastic/elasticsearch-py/pull/3430))
- Sanitize index names in ES|QL query builder (Fixes [#​3422](https://github.com/elastic/elasticsearch-py/issues/3422)) ([#​3425](https://github.com/elastic/elasticsearch-py/pull/3425))
DSL
- Added `flat_index_threshold` attribute to `DenseVectorIndexOptions` type
- Added `field` attribute to `InnerHits` type
- Added `embedding` attribute to `QueryVectorBuilder` type
### [`v9.4.0`](https://github.com/elastic/elasticsearch-py/releases/tag/v9.4.0): 9.4.0
[Compare Source](https://github.com/elastic/elasticsearch-py/compare/v9.3.0...v9.4.0)
#### Enhancements
- ES|QL updates for 9.4 and Serverless ([#​3384](https://github.com/elastic/elasticsearch-py/pull/3384))
- Added `server_mode` parameter to the client’s constructor
#### API
- Added `inference.embedding` API
- Added `inference.put_fireworksai` API
- Added `project.create_many_routing`, `project.create_routing`, `project.delete_routing`, `project.get_many_routing` and `project.get_routing` APIs
- Added `security.clone_api_key` API
- Added `group_by` parameter to `reindex_rethrottle` API
- Added `return_intermediate_results` parameter to `async_search.get` API
- Added `project_routing` and `time_zone` parameters to `esql.async_query` and `esql.query` APIs
- Removed `master_timeout` parameter from `searchable_snapshots.cache_stats` API
- Added `name` parameter to `streams.logs_enable` and `streams.logs_disable` APIs
- Added `should_parse_recursively` parameter to `text_structure.find_field_structure`, `text_structure.find_message_structure` and `text_structure.find_structure` APIs
#### DSL
- Data stream support ([#​3413](https://github.com/elastic/elasticsearch-py/pull/3413))
- Handle document attributes that have a name collision with a method ([#​3364](https://github.com/elastic/elasticsearch-py/issues/3364))
- Added `es_name` parameter to `mapped_field` function
- Added `_es_name` parameter to all subclasses of `Field`
- Added `script` attribute to `MultiTermLookup` type
- Added `lookup` attribute to `QueryVectorBuilder` type
### [`v9.3.0`](https://github.com/elastic/elasticsearch-py/releases/tag/v9.3.0): 9.3.0
[Compare Source](https://github.com/elastic/elasticsearch-py/compare/v9.2.1...v9.3.0)
##### Enhancements
- Add `pack_dense_vector` helper function to pack dense vectors for efficient uploading ([#​3219](https://github.com/elastic/elasticsearch-py/pull/3219))
- New and updated ES|QL functions in the ES|QL query builder for 9.3 and Serverless ([#​3266](https://github.com/elastic/elasticsearch-py/pull/3266))
##### API
- Added `cat.circuit_breaker` API
- Added experimental `esql.get_view`, `esql.put_view` and `esql.delete_view` APIs
- Added experimental `indices.get_sample_configuration`, `indices.put_sample_configuration`, `indices.delete_sample_configuration`, `indices.get_all_sample_configuration`, `indices.get_sample`, `indices.get_sample_stats` APIs
- Added `inference.put_groq`, `inference.put_openshift_ai`, `inference.put_nvidia` APIs
- Added `downsampling_method` argument to `indices.put_data_lifecycle` API
- Added `return_documents` and `top_n` arguments to `inference.rerank` API
- Added `close_job` argument to `ml.stop_datafeed` API
- Added `certificate_identity` to `security.create_cross_cluster_api_key` and `security.update_cross_cluster_api_key` APIs
##### Serverless-specific
- Added `project_routing` argument to `project.tags` API
##### DSL
- Added `NumpyDenseVector` field, with support for dense vectors based on numpy arrays ([#​3218](https://github.com/elastic/elasticsearch-py/pull/3218))
- Added `ExponentialHistogram` field
- Added `time_series_metric` argument to `Histogram` field
- Added `on_disk_rescore` argument from `DenseVectorIndexOptions` type
- Added `slices` argument to `UpdateByQueryResponse` type
</details>
<details>
<summary>fastapi/fastapi (fastapi)</summary>
### [`v0.141.1`](https://github.com/fastapi/fastapi/releases/tag/0.141.1)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.141.0...0.141.1)
##### Fixes
- 🐛 Fix support for background tasks and headers from dependencies in `app.frontend()`. MR [#​16105](https://github.com/fastapi/fastapi/pull/16105) by [@​tiangolo](https://github.com/tiangolo).
##### Docs
- 📝 Document `FASTAPI_ENV` in FastAPI CLI guide. MR [#​16104](https://github.com/fastapi/fastapi/pull/16104) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.141.0`](https://github.com/fastapi/fastapi/releases/tag/0.141.0)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.13...0.141.0)
##### Features
- ✨ Add `app.frontend(check_dir="auto")`, to make local development more convenient with `fastapi dev`. MR [#​16102](https://github.com/fastapi/fastapi/pull/16102) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.13`](https://github.com/fastapi/fastapi/releases/tag/0.140.13)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.12...0.140.13)
##### Fixes
- 🐛 Fix `status_code` being ignored for SSE and JSONL streaming endpoints. MR [#​15937](https://github.com/fastapi/fastapi/pull/15937) by [@​SAURABHSALVE](https://github.com/SAURABHSALVE).
##### Docs
- 📝 Fix `format_sse_event` docstring rendering of `\n\n` terminator. MR [#​15613](https://github.com/fastapi/fastapi/pull/15613) by [@​AshNicolus](https://github.com/AshNicolus).
- 📝 Add API reference page for fastapi.sse. MR [#​15930](https://github.com/fastapi/fastapi/pull/15930) by [@​SAURABHSALVE](https://github.com/SAURABHSALVE).
### [`v0.140.12`](https://github.com/fastapi/fastapi/releases/tag/0.140.12)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.11...0.140.12)
##### Fixes
- 🐛 Fix line splitting in `format_sse_event` to comply with SSE spec. MR [#​15515](https://github.com/fastapi/fastapi/pull/15515) by [@​Zawwarsami16](https://github.com/Zawwarsami16).
### [`v0.140.11`](https://github.com/fastapi/fastapi/releases/tag/0.140.11)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.10...0.140.11)
##### Fixes
- 🐛 Fix `response_model_*` params ignored for non-generator endpoints with `Iterable[..]` return type. MR [#​15093](https://github.com/fastapi/fastapi/pull/15093) by [@​YuriiMotov](https://github.com/YuriiMotov).
### [`v0.140.10`](https://github.com/fastapi/fastapi/releases/tag/0.140.10)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.9...0.140.10)
##### Fixes
- 🐛 Fix handling sequences with nested Annotated types. MR [#​14874](https://github.com/fastapi/fastapi/pull/14874) by [@​YuriiMotov](https://github.com/YuriiMotov).
##### Internal
- 🐛 Accept any base test failure as regression. MR [#​16092](https://github.com/fastapi/fastapi/pull/16092) by [@​tiangolo](https://github.com/tiangolo).
- 🐛 Preserve pytest exit code in regression check. MR [#​16091](https://github.com/fastapi/fastapi/pull/16091) by [@​tiangolo](https://github.com/tiangolo).
- ✅ Test MR regressions against base code. MR [#​16090](https://github.com/fastapi/fastapi/pull/16090) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.9`](https://github.com/fastapi/fastapi/releases/tag/0.140.9)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.8...0.140.9)
##### Fixes
- 🐛 Fix `exclude_defaults` not propagated to dict keys and values in `jsonable_encoder`. MR [#​16043](https://github.com/fastapi/fastapi/pull/16043) by [@​MBGrao](https://github.com/MBGrao).
##### Internal
- ⬆ Bump gitpython from 3.1.50 to 3.1.54. MR [#​16047](https://github.com/fastapi/fastapi/pull/16047) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pymdown-extensions from 10.21.3 to 11.0. MR [#​16048](https://github.com/fastapi/fastapi/pull/16048) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pyasn1 from 0.6.3 to 0.6.4. MR [#​16045](https://github.com/fastapi/fastapi/pull/16045) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
### [`v0.140.8`](https://github.com/fastapi/fastapi/releases/tag/0.140.8)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.7...0.140.8)
##### Fixes
- 🐛 Fix stream item type lost when using `include_router()`. MR [#​15077](https://github.com/fastapi/fastapi/pull/15077) by [@​alex-raw](https://github.com/alex-raw).
### [`v0.140.7`](https://github.com/fastapi/fastapi/releases/tag/0.140.7)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.6...0.140.7)
##### Refactors
- ⚡️ Avoid flattening dependencies for OpenAPI. MR [#​16076](https://github.com/fastapi/fastapi/pull/16076) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- ⬆️ Upgrade latest-changes to 0.7.1. MR [#​16077](https://github.com/fastapi/fastapi/pull/16077) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Add OpenAPI dependency benchmarks. MR [#​16075](https://github.com/fastapi/fastapi/pull/16075) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.6`](https://github.com/fastapi/fastapi/releases/tag/0.140.6)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.5...0.140.6)
##### Refactors
- ⚡️ Avoid flattening dependencies for request parameters, mainly for OpenAPI. MR [#​16073](https://github.com/fastapi/fastapi/pull/16073) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.5`](https://github.com/fastapi/fastapi/releases/tag/0.140.5)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.4...0.140.5)
##### Refactors
- ⚡️ Avoid flattening dependencies for body fields. MR [#​16071](https://github.com/fastapi/fastapi/pull/16071) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.4`](https://github.com/fastapi/fastapi/releases/tag/0.140.4)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.3...0.140.4)
##### Refactors
- ⚡️ Skip unused dependency repeat bookkeeping. MR [#​16069](https://github.com/fastapi/fastapi/pull/16069) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.3`](https://github.com/fastapi/fastapi/releases/tag/0.140.3)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.2...0.140.3)
##### Refactors
- ⚡️ Avoid repeated dependency flattening in OpenAPI. MR [#​16067](https://github.com/fastapi/fastapi/pull/16067) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.2`](https://github.com/fastapi/fastapi/releases/tag/0.140.2)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.1...0.140.2)
##### Refactors
- ⚡️ Stop retaining flat dependency trees. MR [#​16065](https://github.com/fastapi/fastapi/pull/16065) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- 👷 Add new memory benchmark. MR [#​16064](https://github.com/fastapi/fastapi/pull/16064) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.1`](https://github.com/fastapi/fastapi/releases/tag/0.140.1)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.140.0...0.140.1)
##### Refactors
- ♻️ Update the lru\_cache limit for dependencies to account for large apps. MR [#​16062](https://github.com/fastapi/fastapi/pull/16062) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.140.0`](https://github.com/fastapi/fastapi/releases/tag/0.140.0)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.139.2...0.140.0)
##### Refactors
- ⚡️ Reduce memory usage in dependencies. MR [#​16049](https://github.com/fastapi/fastapi/pull/16049) by [@​tiangolo](https://github.com/tiangolo).
##### Docs
- 📝 Fix links in docs. MR [#​15967](https://github.com/fastapi/fastapi/pull/15967) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 📝 Add Library Skills documentation. MR [#​16041](https://github.com/fastapi/fastapi/pull/16041) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Update docs to use uv projects by default. MR [#​16032](https://github.com/fastapi/fastapi/pull/16032) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Restructure FastAPI People and related pages. MR [#​16015](https://github.com/fastapi/fastapi/pull/16015) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- 👷 Add CI memory benchmark. MR [#​16046](https://github.com/fastapi/fastapi/pull/16046) by [@​tiangolo](https://github.com/tiangolo).
- 👥 Update FastAPI People - Sponsors. MR [#​16027](https://github.com/fastapi/fastapi/pull/16027) by [@​tiangolo](https://github.com/tiangolo).
- 🔥 Remove now-obsolete scripts to generate data for FastAPI People. MR [#​16016](https://github.com/fastapi/fastapi/pull/16016) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.139.2`](https://github.com/fastapi/fastapi/releases/tag/0.139.2)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.139.1...0.139.2)
##### Fixes
- 🐛 Refactor router route building to make it thread-safe, mainly relevant for tests running in parallel threads (uncommon). MR [#​16013](https://github.com/fastapi/fastapi/pull/16013) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.139.1`](https://github.com/fastapi/fastapi/releases/tag/0.139.1)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.139.0...0.139.1)
##### Fixes
- 🐛 Fix frontend fallback support for doted paths like `/users/john.doe`. MR [#​16011](https://github.com/fastapi/fastapi/pull/16011) by [@​tiangolo](https://github.com/tiangolo).
##### Docs
- 📝 Fix topic repository list not being displayed and `skip_users` not being applied. MR [#​15995](https://github.com/fastapi/fastapi/pull/15995) by [@​YuriiMotov](https://github.com/YuriiMotov).
##### Translations
- 🌐 Update translations for tr (update-outdated). MR [#​16005](https://github.com/fastapi/fastapi/pull/16005) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh-hant (update-outdated). MR [#​15996](https://github.com/fastapi/fastapi/pull/15996) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for fr (update-outdated). MR [#​16006](https://github.com/fastapi/fastapi/pull/16006) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for de (update-outdated). MR [#​15999](https://github.com/fastapi/fastapi/pull/15999) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ko (update-outdated). MR [#​16004](https://github.com/fastapi/fastapi/pull/16004) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh (update-outdated). MR [#​16001](https://github.com/fastapi/fastapi/pull/16001) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for uk (update-outdated). MR [#​16003](https://github.com/fastapi/fastapi/pull/16003) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ja (update-outdated). MR [#​15998](https://github.com/fastapi/fastapi/pull/15998) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for pt (update-outdated). MR [#​16000](https://github.com/fastapi/fastapi/pull/16000) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for es (update-outdated). MR [#​15997](https://github.com/fastapi/fastapi/pull/15997) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ru (update-outdated). MR [#​16002](https://github.com/fastapi/fastapi/pull/16002) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for hi (add-missing). MR [#​15990](https://github.com/fastapi/fastapi/pull/15990) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for hi (add-missing). MR [#​15925](https://github.com/fastapi/fastapi/pull/15925) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for hi (add-missing). MR [#​15797](https://github.com/fastapi/fastapi/pull/15797) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update `llm-prompt.md` for Hindi. MR [#​15810](https://github.com/fastapi/fastapi/pull/15810) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 🌐 Fix language-specific translation prompt for Russian language. MR [#​15924](https://github.com/fastapi/fastapi/pull/15924) by [@​YuriiMotov](https://github.com/YuriiMotov).
##### Internal
- ⬆ Bump the python-packages group across 1 directory with 6 updates. MR [#​15981](https://github.com/fastapi/fastapi/pull/15981) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump typing-extensions from 4.15.0 to 4.16.0. MR [#​15982](https://github.com/fastapi/fastapi/pull/15982) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump the github-actions group across 1 directory with 4 updates. MR [#​15983](https://github.com/fastapi/fastapi/pull/15983) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pre-commit hooks. MR [#​15985](https://github.com/fastapi/fastapi/pull/15985) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Use `FASTAPI_LATEST_CHANGES` token in `bump-pre-commit-hooks` workflow. MR [#​15984](https://github.com/fastapi/fastapi/pull/15984) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 👷 Add GH workflow to bump pre-commit hook versions. MR [#​15873](https://github.com/fastapi/fastapi/pull/15873) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 🔧 Set Dependabot schedule interval to "monthly". MR [#​15874](https://github.com/fastapi/fastapi/pull/15874) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ⬆ Bump CodSpeedHQ/action from 4.17.6 to 4.18.1 in the github-actions group. MR [#​15950](https://github.com/fastapi/fastapi/pull/15950) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump the python-packages group with 8 updates. MR [#​15952](https://github.com/fastapi/fastapi/pull/15952) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 🔧 Update sponsors: add TutorCruncher. MR [#​15947](https://github.com/fastapi/fastapi/pull/15947) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Fix notify translations checkout target. MR [#​15933](https://github.com/fastapi/fastapi/pull/15933) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Fix latest-changes checkout target. MR [#​15932](https://github.com/fastapi/fastapi/pull/15932) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: remove RapidProxy. MR [#​15929](https://github.com/fastapi/fastapi/pull/15929) by [@​tiangolo](https://github.com/tiangolo).
- ⬆️ Update issue-manager to 0.8.1. MR [#​15928](https://github.com/fastapi/fastapi/pull/15928) by [@​tiangolo](https://github.com/tiangolo).
- ⬆️ Update latest-changes to 0.6.1. MR [#​15926](https://github.com/fastapi/fastapi/pull/15926) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.139.0`](https://github.com/fastapi/fastapi/releases/tag/0.139.0)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.138.2...0.139.0)
##### Features
- ✨ Support dependencies in `app.frontend()`, e.g. for automatic cookie authentication for the frontend. MR [#​15908](https://github.com/fastapi/fastapi/pull/15908) by [@​tiangolo](https://github.com/tiangolo).
##### Translations
- 🌐 Update translations for fr (update-outdated). MR [#​15897](https://github.com/fastapi/fastapi/pull/15897) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ja (update-outdated). MR [#​15895](https://github.com/fastapi/fastapi/pull/15895) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh-hant (update-outdated). MR [#​15896](https://github.com/fastapi/fastapi/pull/15896) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for de (update-outdated). MR [#​15899](https://github.com/fastapi/fastapi/pull/15899) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for es (update-outdated). MR [#​15892](https://github.com/fastapi/fastapi/pull/15892) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for tr (update-outdated). MR [#​15891](https://github.com/fastapi/fastapi/pull/15891) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for pt (update-outdated). MR [#​15893](https://github.com/fastapi/fastapi/pull/15893) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh (update-outdated). MR [#​15898](https://github.com/fastapi/fastapi/pull/15898) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for uk (update-outdated). MR [#​15900](https://github.com/fastapi/fastapi/pull/15900) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ko (update-outdated). MR [#​15890](https://github.com/fastapi/fastapi/pull/15890) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ru (update-outdated). MR [#​15894](https://github.com/fastapi/fastapi/pull/15894) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ko (add-missing). MR [#​15888](https://github.com/fastapi/fastapi/pull/15888) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for es (add-missing). MR [#​15880](https://github.com/fastapi/fastapi/pull/15880) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh-hant (add-missing). MR [#​15889](https://github.com/fastapi/fastapi/pull/15889) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for pt (add-missing). MR [#​15883](https://github.com/fastapi/fastapi/pull/15883) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh (add-missing). MR [#​15885](https://github.com/fastapi/fastapi/pull/15885) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ja (add-missing). MR [#​15882](https://github.com/fastapi/fastapi/pull/15882) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for tr (add-missing). MR [#​15887](https://github.com/fastapi/fastapi/pull/15887) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for uk (add-missing). MR [#​15886](https://github.com/fastapi/fastapi/pull/15886) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for fr (add-missing). MR [#​15881](https://github.com/fastapi/fastapi/pull/15881) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for de (add-missing). MR [#​15884](https://github.com/fastapi/fastapi/pull/15884) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ru (add-missing). MR [#​15879](https://github.com/fastapi/fastapi/pull/15879) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- 👥 Update FastAPI People - Experts. MR [#​15909](https://github.com/fastapi/fastapi/pull/15909) by [@​tiangolo](https://github.com/tiangolo).
- 👥 Update FastAPI GitHub topic repositories. MR [#​15906](https://github.com/fastapi/fastapi/pull/15906) by [@​tiangolo](https://github.com/tiangolo).
- 👥 Update FastAPI People - Contributors and Translators. MR [#​15878](https://github.com/fastapi/fastapi/pull/15878) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Remove not needed `allow-unsafe-pr-checkout: true`. MR [#​15876](https://github.com/fastapi/fastapi/pull/15876) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ⬆ Bump the github-actions group with 5 updates. MR [#​15872](https://github.com/fastapi/fastapi/pull/15872) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump the python-packages group across 1 directory with 10 updates. MR [#​15870](https://github.com/fastapi/fastapi/pull/15870) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump CodSpeedHQ/action from 4.17.0 to 4.17.5 in the github-actions group. MR [#​15826](https://github.com/fastapi/fastapi/pull/15826) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
### [`v0.138.2`](https://github.com/fastapi/fastapi/releases/tag/0.138.2)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.138.1...0.138.2)
##### Refactors
- ♻️ Make `app.frontend()` return 404 for methods other than `GET` or `HEAD` with no static file matches. MR [#​15863](https://github.com/fastapi/fastapi/pull/15863) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- 🔧 Update sponsors: remove Stainless. MR [#​15862](https://github.com/fastapi/fastapi/pull/15862) by [@​tiangolo](https://github.com/tiangolo).
- ♻️ Refactor how sponsors data is handled for banners. MR [#​15852](https://github.com/fastapi/fastapi/pull/15852) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.138.1`](https://github.com/fastapi/fastapi/releases/tag/0.138.1)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.138.0...0.138.1)
##### Refactors
- ♻️ Refactor Library Skills, make info easier to find for agents. MR [#​15841](https://github.com/fastapi/fastapi/pull/15841) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- 👷 Simplify pull request workflow triggers. MR [#​15836](https://github.com/fastapi/fastapi/pull/15836) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Update issue-manager to 0.7.1. MR [#​15833](https://github.com/fastapi/fastapi/pull/15833) by [@​tiangolo](https://github.com/tiangolo).
- ⬆️ Update issue-manager to 0.7.0. MR [#​15831](https://github.com/fastapi/fastapi/pull/15831) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: Add TestMu again. MR [#​15830](https://github.com/fastapi/fastapi/pull/15830) by [@​tiangolo](https://github.com/tiangolo).
- 🔒️ Update zizmor workflow security checks. MR [#​15820](https://github.com/fastapi/fastapi/pull/15820) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump pydantic-settings from 2.14.1 to 2.14.2. MR [#​15799](https://github.com/fastapi/fastapi/pull/15799) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
### [`v0.138.0`](https://github.com/fastapi/fastapi/releases/tag/0.138.0)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.137.2...0.138.0)
##### Features
- ✨ Add support for `app.frontend("/", directory="dist")` and `router.frontend("/", directory="dist")`. MR [#​15800](https://github.com/fastapi/fastapi/pull/15800) by [@​tiangolo](https://github.com/tiangolo).
- Read the docs: [Frontend](https://fastapi.tiangolo.com/tutorial/frontend/).
##### Docs
- 📝 Fix typo in release notes. MR [#​15807](https://github.com/fastapi/fastapi/pull/15807) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Add `app.frontend()` instructions to Agent Library Skill. MR [#​15805](https://github.com/fastapi/fastapi/pull/15805) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Update release notes link. MR [#​15802](https://github.com/fastapi/fastapi/pull/15802) by [@​tiangolo](https://github.com/tiangolo).
- ✏️ Update white space characters in bigger apps. MR [#​15801](https://github.com/fastapi/fastapi/pull/15801) by [@​tiangolo](https://github.com/tiangolo).
- ✏️ Fix grammar, typos, and broken links in docs. MR [#​15694](https://github.com/fastapi/fastapi/pull/15694) by [@​YuriiMotov](https://github.com/YuriiMotov).
##### Translations
- 🌐 Enable Hindi docs translations. MR [#​15554](https://github.com/fastapi/fastapi/pull/15554) by [@​YuriiMotov](https://github.com/YuriiMotov).
##### Internal
- 🐛 Fix failing test, update format for raised errors. MR [#​15804](https://github.com/fastapi/fastapi/pull/15804) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Fix test-alls-green. MR [#​15803](https://github.com/fastapi/fastapi/pull/15803) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Enable checking `release-notes.md` for typos. MR [#​15796](https://github.com/fastapi/fastapi/pull/15796) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 📝 Tweak wording about deploying to FastAPI Cloud. MR [#​15793](https://github.com/fastapi/fastapi/pull/15793) by [@​tiangolo](https://github.com/tiangolo).
- 🔨 Use `gpt-5.5` model in `translate.py`, specify `-chat` to avoid warnings. MR [#​15792](https://github.com/fastapi/fastapi/pull/15792) by [@​YuriiMotov](https://github.com/YuriiMotov).
### [`v0.137.2`](https://github.com/fastapi/fastapi/releases/tag/0.137.2)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.137.1...0.137.2)
##### Features
- ✨ Add `iter_route_contexts()` for advanced use cases that used to use `router.routes` (e.g. Jupyverse). MR [#​15785](https://github.com/fastapi/fastapi/pull/15785) by [@​tiangolo](https://github.com/tiangolo).
##### Translations
- 🌐 Fix broken Markdown in Korean custom response docs. MR [#​15774](https://github.com/fastapi/fastapi/pull/15774) by [@​kooqooo](https://github.com/kooqooo).
- 🌐 Update translations for fr (update-outdated). MR [#​15761](https://github.com/fastapi/fastapi/pull/15761) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh-hant (update-outdated). MR [#​15760](https://github.com/fastapi/fastapi/pull/15760) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for de (update-outdated). MR [#​15759](https://github.com/fastapi/fastapi/pull/15759) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ko (update-outdated). MR [#​15757](https://github.com/fastapi/fastapi/pull/15757) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for uk (update-outdated). MR [#​15756](https://github.com/fastapi/fastapi/pull/15756) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh (update-outdated). MR [#​15755](https://github.com/fastapi/fastapi/pull/15755) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for tr (update-outdated). MR [#​15754](https://github.com/fastapi/fastapi/pull/15754) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for pt (update-outdated). MR [#​15753](https://github.com/fastapi/fastapi/pull/15753) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for es (update-outdated). MR [#​15752](https://github.com/fastapi/fastapi/pull/15752) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ja (update-outdated). MR [#​15751](https://github.com/fastapi/fastapi/pull/15751) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ru (update-outdated). MR [#​15758](https://github.com/fastapi/fastapi/pull/15758) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- 🔧 Update sponsors: add BairesDev. MR [#​15787](https://github.com/fastapi/fastapi/pull/15787) by [@​tiangolo](https://github.com/tiangolo).
- 🔨 Update sponsors script to simplify previews. MR [#​15786](https://github.com/fastapi/fastapi/pull/15786) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump the python-packages group across 1 directory with 7 updates. MR [#​15777](https://github.com/fastapi/fastapi/pull/15777) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump cryptography from 46.0.7 to 48.0.1. MR [#​15779](https://github.com/fastapi/fastapi/pull/15779) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump aiohttp from 3.14.0 to 3.14.1. MR [#​15781](https://github.com/fastapi/fastapi/pull/15781) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump starlette from 1.2.1 to 1.3.1. MR [#​15780](https://github.com/fastapi/fastapi/pull/15780) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump astral-sh/setup-uv from 8.1.0 to 8.2.0 in the github-actions group. MR [#​15776](https://github.com/fastapi/fastapi/pull/15776) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump <https://github.com/crate-ci/typos> from v1.47.1 to v1.47.2 in the pre-commit group. MR [#​15775](https://github.com/fastapi/fastapi/pull/15775) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump python-multipart from 0.0.30 to 0.0.32. MR [#​15778](https://github.com/fastapi/fastapi/pull/15778) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⏪️ Revert removing scripts, only remove `coverage.sh`. MR [#​15772](https://github.com/fastapi/fastapi/pull/15772) by [@​tiangolo](https://github.com/tiangolo).
- 🔥 Remove unused scripts. MR [#​15771](https://github.com/fastapi/fastapi/pull/15771) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Add ty configs to check docs sources. MR [#​15770](https://github.com/fastapi/fastapi/pull/15770) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Add ty configs to check docs sources. MR [#​15769](https://github.com/fastapi/fastapi/pull/15769) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.137.1`](https://github.com/fastapi/fastapi/releases/tag/0.137.1)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.137.0...0.137.1)
##### Fixes
- 🚨 Fix typing checks for APIRoute. MR [#​15765](https://github.com/fastapi/fastapi/pull/15765) by [@​tiangolo](https://github.com/tiangolo).
- 🐛 Fix bug, allow empty path in path operation in prefixless router. MR [#​15763](https://github.com/fastapi/fastapi/pull/15763) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.137.0`](https://github.com/fastapi/fastapi/releases/tag/0.137.0)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.136.3...0.137.0)
##### Breaking Changes
- ♻️ Refactor internals to preserve `APIRouter` and `APIRoute` instances. MR [#​15745](https://github.com/fastapi/fastapi/pull/15745) by [@​tiangolo](https://github.com/tiangolo).
Unblocks ✨ SO MANY THINGS ✨
Before this, `router.include_router(other_router)` would take each path operation from `other_router` and "clone" it, or recreate it from scratch.
This would mean that in the end there was only one top level router, part of the app.
The way it is structured here is that there are a few additional classes to handle intermediate metadata for router and route inclusion. That way the information of "router X includes Y and Y includes Z" is stored somewhere, without affecting (recreating / clonning) the final route.
##### Non Objectives
Dependencies for 404: previously I intended to support dependencies that would be executed even for 404, but that would conflict with the fact that a router could *not* find a match, but the next router *did* find a match. Executing dependencies in the router that did not find a match would not make sense, they could consume the request, body, etc. This original idea was discarded.
##### Specific Breaking Changes
Now `router.routes` is no longer a plain list of `APIRoute` objects, it can contain these intermediate objects that can contain additional routers, forming a tree.
Any logic that depended on iterating on the `router.routes` directly would be affected, that logic cannot expect to be able to extract data from a plain list of routes, as it's no longer a plain list but a tree.
Additionally, any logic that iterated on `router.routes` to modify them would now also see these new objects, and would not see all the routes in the app.
`router.routes` should be considered an internal implementation detail, only passed around to the FastAPI functions that need it.
##### Features
- Adding routes (path operations) after a router is included now works, they are reflected as they are not copied.
- Including `subrouter` in `mainrouter` can be done before adding routes (path operations) to `subrouter`, because now the the entire object is stored instead of copying the routes.
- As routes are not copied, in some cases that might save some memory.
##### Alpha Features
This is not documented yet, so it's not officially supported yet and could change in the future.
But, as `APIRoute` and `APIRouter` instances are now preserved, they could be customized.
`APIRouter` has two new methods, `.matches()` and `.handle()`, counterpart to the existing ones in `APIRoute`. With this a router could customize how it matches and handles requests. For example, it could match only requests that include some specific header, for example for handling versions in headers.
Still, for now, consider this very experimental and potentially changing and breaking in the future.
##### Future Features Enabled
- Custom `APIRoute` subclasses (undocumented, but alraedy works as desccribed above)
- Custom `APIRouter` subclasses (undocumented, but already works as described above)
- Dependencies per router
- Exception handlers per router
- Middleware per router
- Other features planned
##### Docs
- 📝 Update release notes. MR [#​15747](https://github.com/fastapi/fastapi/pull/15747) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Update FastAPI Cloud deployment instructions. MR [#​15724](https://github.com/fastapi/fastapi/pull/15724) by [@​alejsdev](https://github.com/alejsdev).
- ✏️ Use `Annotated` in inline example in `docs/en/docs/tutorial/body-multiple-params.md`. MR [#​15591](https://github.com/fastapi/fastapi/pull/15591) by [@​TheArchons](https://github.com/TheArchons).
- 📝 Remove "NGINX Unit" from the list of ASGI-servers in docs. MR [#​15475](https://github.com/fastapi/fastapi/pull/15475) by [@​angryfoxx](https://github.com/angryfoxx).
- 📝 Update `docs/en/docs/tutorial/security/oauth2-jwt.md`. MR [#​14781](https://github.com/fastapi/fastapi/pull/14781) by [@​zadevhub](https://github.com/zadevhub).
##### Translations
- 🌐 Update translations for zh-hant (update-outdated). MR [#​15671](https://github.com/fastapi/fastapi/pull/15671) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for es (update-outdated). MR [#​15670](https://github.com/fastapi/fastapi/pull/15670) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for fr (update-outdated). MR [#​15669](https://github.com/fastapi/fastapi/pull/15669) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ja (update-outdated). MR [#​15668](https://github.com/fastapi/fastapi/pull/15668) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for pt (update-outdated). MR [#​15667](https://github.com/fastapi/fastapi/pull/15667) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for tr (update-outdated). MR [#​15666](https://github.com/fastapi/fastapi/pull/15666) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh (update-outdated). MR [#​15665](https://github.com/fastapi/fastapi/pull/15665) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ko (update-outdated). MR [#​15664](https://github.com/fastapi/fastapi/pull/15664) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for de (update-outdated). MR [#​15673](https://github.com/fastapi/fastapi/pull/15673) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for uk (update-outdated). MR [#​15672](https://github.com/fastapi/fastapi/pull/15672) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ru (update-outdated). MR [#​15674](https://github.com/fastapi/fastapi/pull/15674) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- 🔧 Update sponsors: remove TalorData. MR [#​15744](https://github.com/fastapi/fastapi/pull/15744) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: remove ExoFlare. MR [#​15736](https://github.com/fastapi/fastapi/pull/15736) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: remove InterviewPal. MR [#​15735](https://github.com/fastapi/fastapi/pull/15735) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: remove Liblab. MR [#​15731](https://github.com/fastapi/fastapi/pull/15731) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: remove Scalar. MR [#​15730](https://github.com/fastapi/fastapi/pull/15730) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump the python-packages group across 1 directory with 6 updates. MR [#​15721](https://github.com/fastapi/fastapi/pull/15721) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump python-multipart from 0.0.29 to 0.0.30. MR [#​15723](https://github.com/fastapi/fastapi/pull/15723) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump the github-actions group with 3 updates. MR [#​15720](https://github.com/fastapi/fastapi/pull/15720) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump starlette from 1.1.0 to 1.2.1. MR [#​15722](https://github.com/fastapi/fastapi/pull/15722) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump <https://github.com/crate-ci/typos> from v1.46.0 to v1.47.1 in the pre-commit group. MR [#​15719](https://github.com/fastapi/fastapi/pull/15719) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 🔧 Update sponsors, add Rapidproxy. MR [#​15689](https://github.com/fastapi/fastapi/pull/15689) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: Remove TestMu. MR [#​15688](https://github.com/fastapi/fastapi/pull/15688) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump the python-packages group across 1 directory with 11 updates. MR [#​15683](https://github.com/fastapi/fastapi/pull/15683) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump aiohttp from 3.13.4 to 3.14.0. MR [#​15681](https://github.com/fastapi/fastapi/pull/15681) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump the github-actions group with 2 updates. MR [#​15682](https://github.com/fastapi/fastapi/pull/15682) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump starlette from 1.0.0 to 1.1.0. MR [#​15684](https://github.com/fastapi/fastapi/pull/15684) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 👥 Update FastAPI People - Experts. MR [#​15677](https://github.com/fastapi/fastapi/pull/15677) by [@​tiangolo](https://github.com/tiangolo).
- 👥 Update FastAPI GitHub topic repositories. MR [#​15675](https://github.com/fastapi/fastapi/pull/15675) by [@​tiangolo](https://github.com/tiangolo).
- 👥 Update FastAPI People - Contributors and Translators. MR [#​15662](https://github.com/fastapi/fastapi/pull/15662) by [@​tiangolo](https://github.com/tiangolo).
- 👷 Automate release preparation. MR [#​15661](https://github.com/fastapi/fastapi/pull/15661) by [@​tiangolo](https://github.com/tiangolo).
- 🔥 Remove slim package stub, deprecated for a while. MR [#​15649](https://github.com/fastapi/fastapi/pull/15649) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump authlib from 1.6.11 to 1.7.2. MR [#​15512](https://github.com/fastapi/fastapi/pull/15512) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pymdown-extensions from 10.21.2 to 10.21.3. MR [#​15569](https://github.com/fastapi/fastapi/pull/15569) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump CodSpeedHQ/action from 4.14.0 to 4.15.1. MR [#​15513](https://github.com/fastapi/fastapi/pull/15513) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump python-multipart from 0.0.26 to 0.0.29. MR [#​15595](https://github.com/fastapi/fastapi/pull/15595) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 🔒️ Improve GitHub actions security. MR [#​15607](https://github.com/fastapi/fastapi/pull/15607) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ⚰️ Remove ruff and coverage ignores for non-existing files. MR [#​15610](https://github.com/fastapi/fastapi/pull/15610) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ✅ Use custom `changing_dir` instead of `CLIRunner.isolated_filesystem` to set working dir. MR [#​15616](https://github.com/fastapi/fastapi/pull/15616) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ✅ Add `httpx2` test dependency to avoid deprecation warning. MR [#​15603](https://github.com/fastapi/fastapi/pull/15603) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ⬆ Bump the python-packages group with 15 updates. MR [#​15594](https://github.com/fastapi/fastapi/pull/15594) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 👷 Configure Dependabot to group updates and update weekly. MR [#​15560](https://github.com/fastapi/fastapi/pull/15560) by [@​YuriiMotov](https://github.com/YuriiMotov).
### [`v0.136.3`](https://github.com/fastapi/fastapi/releases/tag/0.136.3)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.136.1...0.136.3)
##### Refactors
- ♻️ Do not accept underscore headers when using `convert_underscores=True` (the default). MR [#​15589](https://github.com/fastapi/fastapi/pull/15589) by [@​tiangolo](https://github.com/tiangolo).
### [`v0.136.1`](https://github.com/fastapi/fastapi/releases/tag/0.136.1)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.136.0...0.136.1)
##### Upgrades
- ⬆️ Update Pydantic v2 code to address deprecations. MR [#​15101](https://github.com/fastapi/fastapi/pull/15101) by [@​svlandeg](https://github.com/svlandeg).
##### Internal
- 🔨 Tweak translation script. MR [#​15174](https://github.com/fastapi/fastapi/pull/15174) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ⬆ Bump mkdocs-material from 9.7.1 to 9.7.6. MR [#​15408](https://github.com/fastapi/fastapi/pull/15408) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump inline-snapshot from 0.31.1 to 0.32.6. MR [#​15409](https://github.com/fastapi/fastapi/pull/15409) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pytest-codspeed from 4.3.0 to 4.4.0. MR [#​15407](https://github.com/fastapi/fastapi/pull/15407) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pytest-cov from 7.0.0 to 7.1.0. MR [#​15406](https://github.com/fastapi/fastapi/pull/15406) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump cloudflare/wrangler-action from 3.14.1 to 3.15.0. MR [#​15405](https://github.com/fastapi/fastapi/pull/15405) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump mypy from 1.19.1 to 1.20.1. MR [#​15410](https://github.com/fastapi/fastapi/pull/15410) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump python-dotenv from 1.2.1 to 1.2.2. MR [#​15400](https://github.com/fastapi/fastapi/pull/15400) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump starlette from 0.52.1 to 1.0.0. MR [#​15397](https://github.com/fastapi/fastapi/pull/15397) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pygithub from 2.8.1 to 2.9.1. MR [#​15396](https://github.com/fastapi/fastapi/pull/15396) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pyjwt from 2.12.0 to 2.12.1. MR [#​15393](https://github.com/fastapi/fastapi/pull/15393) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump zizmor from 1.23.1 to 1.24.1. MR [#​15394](https://github.com/fastapi/fastapi/pull/15394) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump strawberry-graphql from 0.312.3 to 0.314.3. MR [#​15395](https://github.com/fastapi/fastapi/pull/15395) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump python-multipart from 0.0.22 to 0.0.26. MR [#​15360](https://github.com/fastapi/fastapi/pull/15360) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump authlib from 1.6.9 to 1.6.11. MR [#​15373](https://github.com/fastapi/fastapi/pull/15373) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump aiohttp from 3.13.3 to 3.13.4. MR [#​15282](https://github.com/fastapi/fastapi/pull/15282) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pygments from 2.19.2 to 2.20.0. MR [#​15263](https://github.com/fastapi/fastapi/pull/15263) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pymdown-extensions from 10.20.1 to 10.21.2. MR [#​15391](https://github.com/fastapi/fastapi/pull/15391) by [@​YuriiMotov](https://github.com/YuriiMotov).
- ⬆ Bump pillow from 12.1.1 to 12.2.0. MR [#​15333](https://github.com/fastapi/fastapi/pull/15333) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump pytest from 9.0.2 to 9.0.3. MR [#​15334](https://github.com/fastapi/fastapi/pull/15334) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump actions/upload-artifact from 7.0.0 to 7.0.1. MR [#​15374](https://github.com/fastapi/fastapi/pull/15374) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump actions/cache from 5.0.4 to 5.0.5. MR [#​15385](https://github.com/fastapi/fastapi/pull/15385) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 🔧 Update sponsors: remove Zuplo. MR [#​15369](https://github.com/fastapi/fastapi/pull/15369) by [@​tiangolo](https://github.com/tiangolo).
- 🔧 Update sponsors: remove Speakeasy. MR [#​15368](https://github.com/fastapi/fastapi/pull/15368) by [@​tiangolo](https://github.com/tiangolo).
- 🔒️ Add zizmor and fix audit findings. MR [#​15316](https://github.com/fastapi/fastapi/pull/15316) by [@​YuriiMotov](https://github.com/YuriiMotov).
### [`v0.136.0`](https://github.com/fastapi/fastapi/releases/tag/0.136.0)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.135.4...0.136.0)
##### Upgrades
- ⬆️ Support free-threaded Python 3.14t. MR [#​15149](https://github.com/fastapi/fastapi/pull/15149) by [@​svlandeg](https://github.com/svlandeg).
### [`v0.135.4`](https://github.com/fastapi/fastapi/releases/tag/0.135.4)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.135.3...0.135.4)
##### Refactors
- 🔥 Remove April Fool's `@app.vibe()` 🤪. MR [#​15363](https://github.com/fastapi/fastapi/pull/15363) by [@​tiangolo](https://github.com/tiangolo).
##### Internal
- ⬆ Bump cryptography from 46.0.5 to 46.0.7. MR [#​15314](https://github.com/fastapi/fastapi/pull/15314) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump strawberry-graphql from 0.307.1 to 0.312.3. MR [#​15309](https://github.com/fastapi/fastapi/pull/15309) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 🔨 Add pre-commit hook to ensure latest release header has date. MR [#​15293](https://github.com/fastapi/fastapi/pull/15293) by [@​YuriiMotov](https://github.com/YuriiMotov).
### [`v0.135.3`](https://github.com/fastapi/fastapi/releases/tag/0.135.3)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.135.2...0.135.3)
##### Features
- ✨ Add support for `@app.vibe()`. MR [#​15280](https://github.com/fastapi/fastapi/pull/15280) by [@​tiangolo](https://github.com/tiangolo).
- New docs: [Vibe Coding](https://fastapi.tiangolo.com/advanced/vibe/).
##### Docs
- ✏️ Fix typo for `client_secret` in OAuth2 form docstrings. MR [#​14946](https://github.com/fastapi/fastapi/pull/14946) by [@​bysiber](https://github.com/bysiber).
##### Internal
- 👥 Update FastAPI People - Experts. MR [#​15279](https://github.com/fastapi/fastapi/pull/15279) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump orjson from 3.11.7 to 3.11.8. MR [#​15276](https://github.com/fastapi/fastapi/pull/15276) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- ⬆ Bump ruff from 0.15.0 to 0.15.8. MR [#​15277](https://github.com/fastapi/fastapi/pull/15277) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 👥 Update FastAPI GitHub topic repositories. MR [#​15274](https://github.com/fastapi/fastapi/pull/15274) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump fastmcp from 2.14.5 to 3.2.0. MR [#​15267](https://github.com/fastapi/fastapi/pull/15267) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 👥 Update FastAPI People - Contributors and Translators. MR [#​15270](https://github.com/fastapi/fastapi/pull/15270) by [@​tiangolo](https://github.com/tiangolo).
- ⬆ Bump requests from 2.32.5 to 2.33.0. MR [#​15228](https://github.com/fastapi/fastapi/pull/15228) by [@​dependabot\[bot\]](https://github.com/apps/dependabot).
- 👷 Add ty check to `lint.sh`. MR [#​15136](https://github.com/fastapi/fastapi/pull/15136) by [@​svlandeg](https://github.com/svlandeg).
### [`v0.135.2`](https://github.com/fastapi/fastapi/releases/tag/0.135.2)
[Compare Source](https://github.com/fastapi/fastapi/compare/0.135.1...0.135.2)
##### Upgrades
- ⬆️ Increase lower bound to `pydantic >=2.9.0.` and fix the test suite. MR [#​15139](https://github.com/fastapi/fastapi/pull/15139) by [@​svlandeg](https://github.com/svlandeg).
##### Docs
- 📝 Add missing last release notes dates. MR [#​15202](https://github.com/fastapi/fastapi/pull/15202) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Update docs for contributors and team members regarding translation MRs. MR [#​15200](https://github.com/fastapi/fastapi/pull/15200) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 💄 Fix code blocks in reference docs overflowing table width. MR [#​15094](https://github.com/fastapi/fastapi/pull/15094) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 📝 Fix duplicated words in docstrings. MR [#​15116](https://github.com/fastapi/fastapi/pull/15116) by [@​AhsanSheraz](https://github.com/AhsanSheraz).
- 📝 Add docs for `pyproject.toml` with `entrypoint`. MR [#​15075](https://github.com/fastapi/fastapi/pull/15075) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Update links in docs to no longer use the classes external-link and internal-link. MR [#​15061](https://github.com/fastapi/fastapi/pull/15061) by [@​tiangolo](https://github.com/tiangolo).
- 🔨 Add JS and CSS handling for automatic `target=_blank` for links in docs. MR [#​15063](https://github.com/fastapi/fastapi/pull/15063) by [@​tiangolo](https://github.com/tiangolo).
- 💄 Update styles for internal and external links in new tab. MR [#​15058](https://github.com/fastapi/fastapi/pull/15058) by [@​tiangolo](https://github.com/tiangolo).
- 📝 Add documentation for the FastAPI VS Code extension. MR [#​15008](https://github.com/fastapi/fastapi/pull/15008) by [@​savannahostrowski](https://github.com/savannahostrowski).
- 📝 Fix doctrings for `max_digits` and `decimal_places`. MR [#​14944](https://github.com/fastapi/fastapi/pull/14944) by [@​YuriiMotov](https://github.com/YuriiMotov).
- 📝 Add dates to release notes. MR [#​15001](https://github.com/fastapi/fastapi/pull/15001) by [@​YuriiMotov](https://github.com/YuriiMotov).
##### Translations
- 🌐 Update translations for zh (update-outdated). MR [#​15177](https://github.com/fastapi/fastapi/pull/15177) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh-hant (update-outdated). MR [#​15178](https://github.com/fastapi/fastapi/pull/15178) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh-hant (add-missing). MR [#​15176](https://github.com/fastapi/fastapi/pull/15176) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for zh (add-missing). MR [#​15175](https://github.com/fastapi/fastapi/pull/15175) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ja (update-outdated). MR [#​15171](https://github.com/fastapi/fastapi/pull/15171) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ko (update-outdated). MR [#​15170](https://github.com/fastapi/fastapi/pull/15170) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for tr (update-outdated). MR [#​15172](https://github.com/fastapi/fastapi/pull/15172) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ko (add-missing). MR [#​15168](https://github.com/fastapi/fastapi/pull/15168) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for ja (add-missing). MR [#​15167](https://github.com/fastapi/fastapi/pull/15167) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for tr (add-missing). MR [#​15169](https://github.com/fastapi/fastapi/pull/15169) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for fr (update-outdated). MR [#​15165](https://github.com/fastapi/fastapi/pull/15165) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for fr (add-missing). MR [#​15163](https://github.com/fastapi/fastapi/pull/15163) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for uk (update-outdated). MR [#​15160](https://github.com/fastapi/fastapi/pull/15160) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for uk (add-missing). MR [#​15158](https://github.com/fastapi/fastapi/pull/15158) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for pt (add-missing). MR [#​15157](https://github.com/fastapi/fastapi/pull/15157) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for pt (update-outdated). MR [#​15159](https://github.com/fastapi/fastapi/pull/15159) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for es (update-outdated). MR [#​15155](https://github.com/fastapi/fastapi/pull/15155) by [@​tiangolo](https://github.com/tiangolo).
- 🌐 Update translations for es (add-missing). MR [#​15154](https:/…
When a typed SSE or JSONL streaming endpoint is registered via a router, the OpenAPI schema loses the stream item type information —
itemSchemaends up withoutcontentSchema/contentMediaType(SSE) or as an empty object (JSONL). The endpoints stream correctly at runtime, only the generated schema is affected.This happens because
include_router()re-creates routes viaadd_api_route(), butstream_item_type(computed during the firstAPIRoute.__init__from the return annotation) is not carried over. The re-created route has no way to re-derive it sinceresponse_modelis no longer aDefaultPlaceholderat that point.The fix threads
stream_item_typethroughadd_api_route()andinclude_router(), following the same pattern used forstrict_content_type.Discussed in #15066