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

12 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-04 08:29 +0000

1from typing import Union 1abcdefg

2 

3from fastapi import Depends, FastAPI 1abcdefg

4from typing_extensions import Annotated 1abcdefg

5 

6app = FastAPI() 1abcdefg

7 

8 

9async def common_parameters( 1abcdefg

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

11): 

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

13 

14 

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

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

17 return commons 1hijklmn

18 

19 

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

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

22 return commons 1hijklmn