docs_src/additional_responses/tutorial001_py310.py PYTHON 23 lines View on github.com → Search inside
1from fastapi import FastAPI2from fastapi.responses import JSONResponse3from pydantic import BaseModel456class Item(BaseModel):7    id: str8    value: str91011class Message(BaseModel):12    message: str131415app = FastAPI()161718@app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}})19async def read_item(item_id: str):20    if item_id == "foo":21        return {"id": "foo", "value": "there goes my hero"}22    return JSONResponse(status_code=404, content={"message": "Item not found"})

Code quality findings 1

Ensure functions have docstrings for documentation
missing-docstring
async def read_item(item_id: str):

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.