Compare commits

...
3 Commits
Author SHA1 Message Date
Sebastián Ramírezandgithub-actions[bot] bcd4e895e1 🔖 Release version 0.140.6 (#16074)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-07-27 16:28:46 +00:00
github-actions[bot] 27c922c403 📝 Update release notes
[skip ci]
2026-07-27 16:18:08 +00:00
Sebastián Ramírez cc96fd3a7c ️ Avoid flattening dependencies for request parameters, mainly for OpenAPI (#16073) 2026-07-27 16:17:33 +00:00
3 changed files with 32 additions and 6 deletions

No files matched your search

+6
View File
@@ -7,6 +7,12 @@ hide:
## Latest Changes
## 0.140.6 (2026-07-27)
### Refactors
* ⚡️ Avoid flattening dependencies for request parameters, mainly for OpenAPI. PR [#16073](https://github.com/fastapi/fastapi/pull/16073) by [@tiangolo](https://github.com/tiangolo).
## 0.140.5 (2026-07-27)
### Refactors
+1 -1
View File
@@ -1,6 +1,6 @@
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
__version__ = "0.140.5"
__version__ = "0.140.6"
from starlette import status as status
+25 -5
View File
@@ -242,11 +242,31 @@ def _get_flat_fields_from_params(fields: list[ModelField]) -> list[ModelField]:
def get_flat_params(dependant: Dependant) -> list[ModelField]:
flat_dependant = get_flat_dependant(dependant, skip_repeats=True)
path_params = _get_flat_fields_from_params(flat_dependant.path_params)
query_params = _get_flat_fields_from_params(flat_dependant.query_params)
header_params = _get_flat_fields_from_params(flat_dependant.header_params)
cookie_params = _get_flat_fields_from_params(flat_dependant.cookie_params)
path_params: list[ModelField] = []
query_params: list[ModelField] = []
header_params: list[ModelField] = []
cookie_params: list[ModelField] = []
visited: list[DependencyCacheKey] = []
uses_scopes_cache: _UsesScopesCache = {}
dependants = [dependant]
while dependants:
current_dependant = dependants.pop()
cache_key = _get_cache_key(
dependant=current_dependant,
uses_scopes_cache=uses_scopes_cache,
)
if cache_key in visited:
continue
visited.append(cache_key)
path_params.extend(current_dependant.path_params)
query_params.extend(current_dependant.query_params)
header_params.extend(current_dependant.header_params)
cookie_params.extend(current_dependant.cookie_params)
dependants.extend(reversed(current_dependant.dependencies))
path_params = _get_flat_fields_from_params(path_params)
query_params = _get_flat_fields_from_params(query_params)
header_params = _get_flat_fields_from_params(header_params)
cookie_params = _get_flat_fields_from_params(cookie_params)
return path_params + query_params + header_params + cookie_params