Skip to content

Commit c273500

Browse files
authored
fix: FastAPI 0.112.4+ compatibility (#1766)
* fix: FastAPI 0.112.4+ compatibility * lint: fix mypy * chore: bump version
1 parent c50e054 commit c273500

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

faststream/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Simple and fast framework to create message brokers based microservices."""
22

3-
__version__ = "0.5.21"
3+
__version__ = "0.5.22"
44

55
SERVICE_NAME = f"faststream-{__version__}"

faststream/broker/fastapi/_compat.py

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
FASTAPI_V2 = major > 0 or minor > 100
1717
FASTAPI_V106 = major > 0 or minor >= 106
1818
FASTAPI_v102_3 = major > 0 or minor > 112 or (minor == 112 and patch > 2)
19+
FASTAPI_v102_4 = major > 0 or minor > 112 or (minor == 112 and patch > 3)
1920

2021
__all__ = (
2122
"create_response_field",
@@ -56,6 +57,8 @@ def raise_fastapi_validation_error(errors: List[Any], body: AnyDict) -> Never:
5657
create_model_field as create_response_field,
5758
)
5859

60+
extra = {"embed_body_fields": False} if FASTAPI_v102_4 else {}
61+
5962
async def solve_faststream_dependency(
6063
request: "Request",
6164
dependant: "Dependant",
@@ -67,6 +70,7 @@ async def solve_faststream_dependency(
6770
body=request._body, # type: ignore[arg-type]
6871
dependant=dependant,
6972
dependency_overrides_provider=dependency_overrides_provider,
73+
**extra, # type: ignore[arg-type]
7074
**kwargs,
7175
)
7276
values, errors, background = (

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ test-core = [
128128

129129
testing = [
130130
"faststream[test-core]",
131-
"fastapi==0.112.3",
131+
"fastapi==0.113.0",
132132
"pydantic-settings>=2.0.0,<3.0.0",
133133
"httpx==0.27.2",
134134
"PyYAML==6.0.2",

0 commit comments

Comments
 (0)