I'm trying to add validation to my route in a fastapi server, followed the instructions here and managed to have added validation on my int path parameters like so:
route1 = router.get("/start={start:int}/end={end:int}")(route1_func)
and my route1_func:
async def route1_func(request: Request,
start: int = Path(..., title="my start", ge=1),
end: int = Path(..., title="my end", ge=1)):
if end <= start:
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)
else:
return True
and this works great... but i would like to validate the end > start if possible as part of the definition, instead of checking this after going into route1_func
is this possible?