From 1ecaffab8aab9f7655fde926146a942b6f0c224d Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Thu, 5 Sep 2024 17:41:36 -0400 Subject: [PATCH] core[patch]: Fix regression in core (#26121) Limited to unit testing code -- did not cause any actual issues --- libs/core/tests/unit_tests/pydantic_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/core/tests/unit_tests/pydantic_utils.py b/libs/core/tests/unit_tests/pydantic_utils.py index 05bc658251c..c9d258d3dbd 100644 --- a/libs/core/tests/unit_tests/pydantic_utils.py +++ b/libs/core/tests/unit_tests/pydantic_utils.py @@ -70,13 +70,14 @@ def _remove_enum_description(obj: Any) -> None: def _schema(obj: Any) -> dict: """Return the schema of the object.""" - # Remap to old style schema + if not is_basemodel_subclass(obj): raise TypeError( f"Object must be a Pydantic BaseModel subclass. Got {type(obj)}" ) + # Remap to old style schema if not hasattr(obj, "model_json_schema"): # V1 model - return obj.model_json_schema() + return obj.schema() schema_ = obj.model_json_schema(ref_template="#/definitions/{model}") if "$defs" in schema_: