diff --git a/propan/brokers/_model/schemas.py b/propan/brokers/_model/schemas.py index b1598973..b0379632 100644 --- a/propan/brokers/_model/schemas.py +++ b/propan/brokers/_model/schemas.py @@ -56,7 +56,7 @@ def get_message_object(self) -> Tuple[str, AnyDict, Optional[AnyDict]]: if getattr(dependant, "return_field", None) is not None: return_field = dependant.return_field - if issubclass(return_field.type_, BaseModel): + if return_field.type_ != Any and issubclass(return_field.type_, BaseModel): return_model = return_field.type_ if not return_model.Config.schema_extra.get("example"): return_model = add_example_to_model(return_model) @@ -101,7 +101,7 @@ def get_message_object(self) -> Tuple[str, AnyDict, Optional[AnyDict]]: elif params_number == 1: param = params[0] - if issubclass(param.annotation, BaseModel): + if param.annotation != Any and issubclass(param.annotation, BaseModel): model = param.annotation gen_examples = model.Config.schema_extra.get("example") is None use_original_model = True diff --git a/pyproject.toml b/pyproject.toml index 291353be..e1140228 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,7 @@ async-kafka = [ doc = [ "PyYAML", - "pytest[email]", + "pydantic[email]", "polyfactory; python_version > '3.7'", "jsonref", "fastapi", diff --git a/tests/utils/context/test_alias.py b/tests/utils/context/test_alias.py index 3e917668..7f2685a5 100644 --- a/tests/utils/context/test_alias.py +++ b/tests/utils/context/test_alias.py @@ -4,7 +4,6 @@ from typing_extensions import Annotated from propan.utils import Context, ContextRepo, apply_types -from tests.tools.marks import needs_py310 @pytest.mark.asyncio @@ -35,7 +34,6 @@ async def func( assert await func(model=model) -@needs_py310 @pytest.mark.asyncio async def test_annotated_alias(context: ContextRepo): model = SomeModel(field=SomeModel(field=1000))