From ea038955f9575bca79dac789b1a1603e31be7c05 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Sat, 7 Dec 2024 20:28:35 +0000 Subject: [PATCH] follow recommendations from FastAPI documentation --- src/eduid/vccs/server/endpoints/add_creds.py | 3 ++- src/eduid/vccs/server/endpoints/authenticate.py | 3 ++- src/eduid/vccs/server/endpoints/revoke_creds.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/eduid/vccs/server/endpoints/add_creds.py b/src/eduid/vccs/server/endpoints/add_creds.py index ff0042c77..12e3ab5d1 100644 --- a/src/eduid/vccs/server/endpoints/add_creds.py +++ b/src/eduid/vccs/server/endpoints/add_creds.py @@ -1,4 +1,5 @@ import json +from typing import Annotated from fastapi import APIRouter, Form, Request from pydantic.main import BaseModel @@ -29,7 +30,7 @@ class AddCredsFormResponse(BaseModel): @add_creds_router.post("/add_creds") -async def add_creds_legacy(req: Request, request: str = Form(...)) -> AddCredsFormResponse: +async def add_creds_legacy(req: Request, request: Annotated[str, Form(...)]) -> AddCredsFormResponse: req.app.logger.debug(f"Add credentials (using form): {request}") class AddCredsInnerRequest(BaseModel): diff --git a/src/eduid/vccs/server/endpoints/authenticate.py b/src/eduid/vccs/server/endpoints/authenticate.py index 7ec8eb664..bc1a8d1b8 100644 --- a/src/eduid/vccs/server/endpoints/authenticate.py +++ b/src/eduid/vccs/server/endpoints/authenticate.py @@ -1,4 +1,5 @@ import json +from typing import Annotated from fastapi import APIRouter, Form, Request from pydantic.main import BaseModel @@ -30,7 +31,7 @@ class AuthenticateFormResponse(BaseModel): @authenticate_router.post("/authenticate") -async def authenticate_legacy(req: Request, request: str = Form(...)) -> AuthenticateFormResponse: +async def authenticate_legacy(req: Request, request: Annotated[str, Form(...)]) -> AuthenticateFormResponse: req.app.logger.debug(f"Authenticate (using form): {request}") class AuthenticateInnerRequest(BaseModel): diff --git a/src/eduid/vccs/server/endpoints/revoke_creds.py b/src/eduid/vccs/server/endpoints/revoke_creds.py index 60d049465..be9e4b314 100644 --- a/src/eduid/vccs/server/endpoints/revoke_creds.py +++ b/src/eduid/vccs/server/endpoints/revoke_creds.py @@ -1,4 +1,5 @@ import json +from typing import Annotated from fastapi import APIRouter, Form, Request from pydantic.main import BaseModel @@ -29,7 +30,7 @@ class RevokeCredsFormResponse(BaseModel): @revoke_creds_router.post("/revoke_creds") -async def revoke_creds_legacy(req: Request, request: str = Form(...)) -> RevokeCredsFormResponse: +async def revoke_creds_legacy(req: Request, request: Annotated[str, Form(...)]) -> RevokeCredsFormResponse: req.app.logger.debug(f"Revoke credentials (using form): {request}") class RevokeCredsInnerRequest(BaseModel):