-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
In backend/apps/task/semester_routers.py, line 42 we have
if (
semester["dLesson"] < 0
or semester["dBreak"] < 0
or semester["slotCount"] < 3
or semester["slotCount"] > 15
):We should always validate user inputs before we process them. But it might be cleaner to do it using FastAPI features.
Here is the page describing validating body fields.
So instead of validating things in the function, we can validate things in the model and delegate FastAPI to do that.
In the model, it might be something like
dLesson: int = Field(..., gt=0)They also mention the same tricks apply to query and path parameters.
Metadata
Metadata
Assignees
Labels
No labels