Coverage for docs_src / path_params_numeric_validations / tutorial006_an_py310.py: 100%
11 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 typing import Annotated 1defghij
3from fastapi import FastAPI, Path, Query 1defghij
5app = FastAPI() 1defghij
8@app.get("/items/{item_id}") 1defghij
9async def read_items( 1defghij
10 *,
11 item_id: Annotated[int, Path(title="The ID of the item to get", ge=0, le=1000)],
12 q: str,
13 size: Annotated[float, Query(gt=0, lt=10.5)],
14):
15 results = {"item_id": item_id} 1kalmbnc
16 if q: 1kalmbnc
17 results.update({"q": q}) 1aobc
18 if size: 1kalmbnc
19 results.update({"size": size}) 1kalmbnc
20 return results 1kalmbnc