Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ ignore = [
"SLF001",
"B008",
"PLR2004",
"CPY",
]

[lint.per-file-ignores]
Expand Down
23 changes: 12 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,34 @@ dependencies = [

[dependency-groups]
linters = [
"ruff==0.15.20",
"ruff==0.16.0",
"typos==1.48.0",
"codespell==2.4.3",
]
static_analysis = [
"mypy==2.1.0",
"mypy==2.3.0",
"bandit==1.9.4",
"semgrep==1.169.0",
"zizmor==1.27.0",
"semgrep==1.171.0",
"zizmor==1.28.0",
]
docs = [
"zensical==0.0.50",
"zensical==0.0.51",
"mkdocstrings[python]==1.0.6",
]

testing = [
"pytest==9.0.3",
"pytest-asyncio==1.3.0",
"pytest-xdist>=3.8.0",
"pytest==9.1.1",
"pytest-asyncio==1.4.0",
"pytest-xdist==3.8.0",
"pytest-timeout==2.4.0",
"pytest-cov>=6.2.1",
"covdefaults>=2.3.0",
"pytest-cov==7.1.0",
"covdefaults==2.3.0",
{ include-group = "testing-dependencies" },
]
testing-dependencies = [
"httpx2==2.5.0",
"asgi-lifespan==2.1.0",
"asgi_lifespan==2.1.0",
"zmqtt==0.0.5",
"faststream[rabbit,kafka,confluent,nats,redis,mqtt]>=0.7.0",
]

Expand Down
2 changes: 1 addition & 1 deletion src/faststream_fastapi/_internal/fastapi_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def raise_fastapi_validation_error(
errors: list[Any],
body: dict[str, Any],
) -> Never:
raise RequestValidationError(errors, ROUTER_VALIDATION_ERROR_MODEL) # type: ignore[misc]
raise RequestValidationError(errors, ROUTER_VALIDATION_ERROR_MODEL) # type: ignore[call-arg]


if FASTAPI_v102_3:
Expand Down
13 changes: 1 addition & 12 deletions src/faststream_fastapi/_internal/get_dependant.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from collections.abc import Callable, Iterable
from typing import Annotated, Any, Final, cast, get_args, get_origin

from fast_depends.library.serializer import OptionItem
from fast_depends.utils import get_typed_annotation
from fastapi.dependencies.models import Dependant
from fastapi.dependencies.utils import (
Expand All @@ -11,7 +10,7 @@
get_typed_signature,
)
from fastapi.params import Depends
from pydantic import Field, create_model
from pydantic import Field

from faststream_fastapi._internal.fs_re_exports._compat import PYDANTIC_V2, PydanticUndefined

Expand Down Expand Up @@ -118,16 +117,6 @@ def _patch_fastapi_dependent(dependant: Dependant) -> Dependant:
f,
)

dependant.model = create_model( # type: ignore[attr-defined]
getattr(call, "__name__", type(call).__name__),
)

dependant.custom_fields = {} # type: ignore[attr-defined]
dependant.flat_params = [ # type: ignore[attr-defined]
OptionItem(field_name=name, field_type=type_, default_value=default)
for name, (type_, default) in params_unique.items()
]

return dependant


Expand Down
6 changes: 3 additions & 3 deletions src/faststream_fastapi/asyncapi_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def __init__(
tags: Sequence[Tag | TagDict | dict[str, Any]] | None = None,
unique_id: str | None = None,
include_in_schema: bool = False,
asyncapi_json_path: str | None | _Empty = _EMPTY,
asyncapi_yaml_path: str | None | _Empty = _EMPTY,
try_it_out_path: str | None | _Empty = _EMPTY,
asyncapi_json_path: str | _Empty | None = _EMPTY,
asyncapi_yaml_path: str | _Empty | None = _EMPTY,
try_it_out_path: str | _Empty | None = _EMPTY,
sidebar: bool = True,
info: bool = True,
servers: bool = True,
Expand Down
10 changes: 5 additions & 5 deletions tests/base/in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async def test_faststream_context_annotated(self, queue: str) -> None:
args, kwargs = self.get_subscriber_params(queue)

@broker.subscriber(*args, **kwargs)
async def hello(msg: Annotated[Any, FSContext("message.headers")]) -> Any:
async def hello(msg: Annotated[Any, FSContext("message")]) -> Any:
return await msg.decode()

async with (
Expand All @@ -262,8 +262,8 @@ async def test_combined_context_annotated(self, queue: str) -> None:
async def hello(
message: Annotated[
Any,
Context("message.headers"),
FSContext("message.headers"),
Context("message"),
FSContext("message"),
],
) -> Any:
return await message.decode()
Expand All @@ -286,8 +286,8 @@ async def test_nested_combined_context_annotated(self, queue: str) -> None:
@broker.subscriber(*args, **kwargs)
async def hello(
message: Annotated[
Annotated[Any, FSContext("message.headers")],
Context("message.headers"),
Annotated[Any, FSContext("message")],
Context("message"),
],
) -> Any:
return await message.decode()
Expand Down
Loading
Loading