Coverage for docs_src/dependencies/tutorial001_an.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-05-05 00:03 +0000

1from typing import Union 1abcdef

2 

3from fastapi import Depends, FastAPI 1abcdef

4from typing_extensions import Annotated 1abcdef

5 

6app = FastAPI() 1abcdef

7 

8 

9async def common_parameters( 1abcdef

10 q: Union[str, None] = None, skip: int = 0, limit: int = 100 

11): 

12 return {"q": q, "skip": skip, "limit": limit} 1ghijkl

13 

14 

15@app.get("/items/") 1abcdef

16async def read_items(commons: Annotated[dict, Depends(common_parameters)]): 1abcdef

17 return commons 1ghijkl

18 

19 

20@app.get("/users/") 1abcdef

21async def read_users(commons: Annotated[dict, Depends(common_parameters)]): 1abcdef

22 return commons 1ghijkl