From 0fa34fdb003d87bad5f5258dc93685f4db575cf8 Mon Sep 17 00:00:00 2001 From: Timur Enikeev Date: Tue, 17 Sep 2024 13:58:46 -0400 Subject: [PATCH] Pydantic 2.9 fix --- auth_backend/schemas/types/scopes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/auth_backend/schemas/types/scopes.py b/auth_backend/schemas/types/scopes.py index e3216ffd..ce33acfc 100644 --- a/auth_backend/schemas/types/scopes.py +++ b/auth_backend/schemas/types/scopes.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')