diff --git a/src/pydantype/utils.py b/src/pydantype/utils.py index 5717863..bd78c9a 100644 --- a/src/pydantype/utils.py +++ b/src/pydantype/utils.py @@ -1,8 +1,8 @@ from typing import Any, Union, get_origin, get_args from pydantic import BaseModel -def is_pydantic_model(obj: Any) -> bool: - return isinstance(obj, type) and issubclass(obj, BaseModel) +def is_pydantic_model(type_: type) -> bool: + return isinstance(type_, type) and not isinstance(type_, GenericAlias) and (issubclass(type_, BaseModel)) def is_optional(annotation: Any) -> bool: - return get_origin(annotation) is Union and type(None) in get_args(annotation) \ No newline at end of file + return get_origin(annotation) is Union and type(None) in get_args(annotation)