Coverage for docs_src / path_params_numeric_validations / tutorial001_py310.py: 100%
8 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
1from fastapi import FastAPI, Path, Query 1abcdefg
3app = FastAPI() 1abcdefg
6@app.get("/items/{item_id}") 1abcdefg
7async def read_items( 1abcdefg
8 item_id: int = Path(title="The ID of the item to get"),
9 q: str | None = Query(default=None, alias="item-query"),
10):
11 results = {"item_id": item_id} 1lhminjok
12 if q: 1lhminjok
13 results.update({"q": q}) 1hijk
14 return results 1lhminjok