Skip to content

Commit e9a7fc8

Browse files
committed
Revert "Update pydantic hack"
This reverts commit ef055f6.
1 parent bacef82 commit e9a7fc8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

temporalio/converter.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,12 +1523,11 @@ def value_to_type(
15231523
# TODO(cretz): Want way to convert snake case to camel case?
15241524
return hint(**field_values)
15251525

1526-
# Use validate() method if present (suggests it is a Pydantic model)
1527-
pydantic_validate_attr = inspect.getattr_static(
1528-
hint, "validate", None
1529-
) or inspect.getattr_static(hint, "parse_obj", None)
1530-
if isinstance(pydantic_validate_attr, classmethod) or isinstance(
1531-
pydantic_validate_attr, staticmethod
1526+
# If there is a @staticmethod or @classmethod parse_obj, we will use it.
1527+
# This covers Pydantic models.
1528+
parse_obj_attr = inspect.getattr_static(hint, "parse_obj", None)
1529+
if isinstance(parse_obj_attr, classmethod) or isinstance(
1530+
parse_obj_attr, staticmethod
15321531
):
15331532
if not isinstance(value, dict):
15341533
raise TypeError(

0 commit comments

Comments
 (0)