From 3f2de008701be069239f7a15df2c892897fa08d1 Mon Sep 17 00:00:00 2001 From: matthew-giglio <140546283+matthew-giglio@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:09:50 -0500 Subject: [PATCH] fix(python): patch v1_on_v2 pydantic utilities (#5426) * fix(python): patch v1_on_v2 pydantic utilities * updated seeds --------- Co-authored-by: eden wang <64514273+eyw520@users.noreply.github.com> --- .../shared/with_pydantic_v1_on_v2/pydantic_utilities.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generators/python/core_utilities/shared/with_pydantic_v1_on_v2/pydantic_utilities.py b/generators/python/core_utilities/shared/with_pydantic_v1_on_v2/pydantic_utilities.py index c879bfff336..a34f7084a69 100644 --- a/generators/python/core_utilities/shared/with_pydantic_v1_on_v2/pydantic_utilities.py +++ b/generators/python/core_utilities/shared/with_pydantic_v1_on_v2/pydantic_utilities.py @@ -37,7 +37,7 @@ def parse_obj_as(type_: typing.Type[T], object_: typing.Any) -> T: dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read") - return pydantic.parse_obj_as(type_, dealiased_object) + return pydantic.v1.parse_obj_as(type_, dealiased_object) def to_jsonable_with_fallback( @@ -173,14 +173,14 @@ def universal_root_validator( pre: bool = False, ) -> typing.Callable[[AnyCallable], AnyCallable]: def decorator(func: AnyCallable) -> AnyCallable: - return pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1 + return pydantic.v1.root_validator(pre=pre)(func) # type: ignore # Pydantic v1 return decorator def universal_field_validator(field_name: str, pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]: def decorator(func: AnyCallable) -> AnyCallable: - return pydantic.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1 + return pydantic.v1.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1 return decorator