FastAPI - Path Parameters - int
examples/fastapi/userid-path/main.py
from fastapi import FastAPI app = FastAPI() @app.get("/user/{user_id}") async def root(user_id: int): return {'user': user_id}
http://localhost:8000/user/23 works http://localhost:8000/user/foo 422 error http://localhost:8000/user/2.3 422 error