Coverage for docs_src/metadata/tutorial004.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from fastapi import FastAPI 1abcde
3tags_metadata = [ 1abcde
4 {
5 "name": "users",
6 "description": "Operations with users. The **login** logic is also here.",
7 },
8 {
9 "name": "items",
10 "description": "Manage items. So _fancy_ they have their own docs.",
11 "externalDocs": {
12 "description": "Items external docs",
13 "url": "https://fastapi.tiangolo.com/",
14 },
15 },
16]
18app = FastAPI(openapi_tags=tags_metadata) 1abcde
21@app.get("/users/", tags=["users"]) 1abcde
22async def get_users(): 1abcde
23 return [{"name": "Harry"}, {"name": "Ron"}] 1abcde
26@app.get("/items/", tags=["items"]) 1abcde
27async def get_items(): 1abcde
28 return [{"name": "wand"}, {"name": "flying broom"}] 1abcde