Skip to content

Commit

Permalink
follow recommendations from FastAPI documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
helylle committed Dec 7, 2024
1 parent e1db220 commit ea03895
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/eduid/vccs/server/endpoints/add_creds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from typing import Annotated

from fastapi import APIRouter, Form, Request
from pydantic.main import BaseModel
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion src/eduid/vccs/server/endpoints/authenticate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from typing import Annotated

from fastapi import APIRouter, Form, Request
from pydantic.main import BaseModel
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion src/eduid/vccs/server/endpoints/revoke_creds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from typing import Annotated

from fastapi import APIRouter, Form, Request
from pydantic.main import BaseModel
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit ea03895

Please sign in to comment.