تخطَّ إلى المحتوى

Missing API response type (ARCH2201)

هذا المحتوى غير متوفر بلغتك بعد.

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.

@app.get("/users/{uid}")
def get_user(uid: int):
return repo.find(uid)
@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.