Coverage for docs_src / path_params_numeric_validations / tutorial001_an_py310.py: 100%
9 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from typing import Annotated 1abc
3from fastapi import FastAPI, Path, Query 1abc
5app = FastAPI() 1abc
8@app.get("/items/{item_id}") 1abc
9async def read_items( 1abc
10 item_id: Annotated[int, Path(title="The ID of the item to get")],
11 q: Annotated[str | None, Query(alias="item-query")] = None,
12):
13 results = {"item_id": item_id} 1def
14 if q: 1def
15 results.update({"q": q}) 1def
16 return results 1def