Skip to content

Commit

Permalink
fix compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Jun 16, 2023
1 parent 6c854a7 commit 0fe87d6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions propan/brokers/_model/schemas.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -79,7 +79,7 @@ async-kafka = [

doc = [
"PyYAML",
"pytest[email]",
"pydantic[email]",
"polyfactory; python_version > '3.7'",
"jsonref",
"fastapi",
Expand Down
2 changes: 0 additions & 2 deletions tests/utils/context/test_alias.py
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 0fe87d6

Please sign in to comment.