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

12 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from typing import Union 1abcde

2 

3from fastapi import Depends, FastAPI 1abcde

4from typing_extensions import Annotated 1abcde

5 

6app = FastAPI() 1abcde

7 

8 

9async def common_parameters( 1abcde

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

11): 

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

13 

14 

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

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

17 return commons 1abcde

18 

19 

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

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

22 return commons 1abcde