Missing API response type (ARCH2201)
Ce contenu n’est pas encore disponible dans votre langue.
Key python.quality.missing-response-model · Severity info · Category quality
Handlers that don’t declare a response schema weaken the generated OpenAPI docs and leave the client contract ambiguous. Declare a response model.
Incorrect
Section titled “Incorrect”@app.get("/users/{uid}")def get_user(uid: int): return repo.find(uid)Correct
Section titled “Correct”@app.get("/users/{uid}", response_model=UserOut)def get_user(uid: int) -> UserOut: return repo.find(uid)Declare an explicit response model/schema and status codes on the handler.