From 40192bf217c3b9f0318c0455d096faed489e63dc Mon Sep 17 00:00:00 2001 From: Timur Enikeev Date: Sat, 5 Oct 2024 13:39:13 -0400 Subject: [PATCH] Pydantic 2.9 fix --- userdata_api/schemas/types/scope.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/userdata_api/schemas/types/scope.py b/userdata_api/schemas/types/scope.py index e3216ff..ce33acf 100644 --- a/userdata_api/schemas/types/scope.py +++ b/userdata_api/schemas/types/scope.py @@ -1,7 +1,7 @@ import string from typing import Any -from pydantic._internal import _schema_generation_shared +from pydantic import GetCoreSchemaHandler, GetJsonSchemaHandler from pydantic.json_schema import JsonSchemaValue from pydantic_core import core_schema @@ -19,12 +19,13 @@ class Scope: def __get_pydantic_core_schema__( cls, source: type[Any], + handler: GetCoreSchemaHandler, ) -> core_schema.CoreSchema: return core_schema.general_after_validator_function(cls._validate, core_schema.str_schema()) @classmethod def __get_pydantic_json_schema__( - cls, core_schema: core_schema.CoreSchema, handler: _schema_generation_shared.GetJsonSchemaHandler + cls, core_schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler ) -> JsonSchemaValue: field_schema = handler(core_schema) field_schema.update(type='string', format='scope')