-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
While working through "FastAPI: Modern Python Web Development," I discovered an error in Example 6-1 on page [page number]. The example imports and uses a Params class that doesn't exist in the FastAPI framework:
`
from fastapi import FastAPI, Depends, Params # Error: Params doesn't exist
app = FastAPI()
-# the dependency function:
def user_dep(name: str = Params, password: str = Params): # Error: Invalid usage
return {"name": name, "valid": True}
-# the path function / web endpoint:
@app.get("/user")
def get_user(user: dict = Depends(user_dep)) -> dict:
return user
`
FastAPI doesn't have a Params class. For required parameters in a dependency function, we should either:
Metadata
Metadata
Assignees
Labels
No labels