From fe80b9e5a898445954557b495f50c2c3c67365dd Mon Sep 17 00:00:00 2001 From: Caleb Norman <53488994+calebnorman@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:09:47 -0500 Subject: [PATCH] Update _utils.py --- fastapi_crudrouter/core/_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastapi_crudrouter/core/_utils.py b/fastapi_crudrouter/core/_utils.py index ef3562e4..045d4864 100644 --- a/fastapi_crudrouter/core/_utils.py +++ b/fastapi_crudrouter/core/_utils.py @@ -14,7 +14,7 @@ def __init__(self, *args, **kwargs) -> None: # type: ignore def get_pk_type(schema: Type[PYDANTIC_SCHEMA], pk_field: str) -> Any: try: - return schema.__fields__[pk_field].type_ + return schema.model_fields[pk_field].annotation except KeyError: return int @@ -27,8 +27,8 @@ def schema_factory( """ fields = { - f.name: (f.type_, ...) - for f in schema_cls.__fields__.values() + f.alias: (f.annotation, f) + for f in schema_cls.model_fields.values() if f.name != pk_field_name }