Coverage for docs_src/metadata/tutorial004.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-05 00:03 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-05 00:03 +0000
1from fastapi import FastAPI 1abcdef
3tags_metadata = [ 1abcdef
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) 1abcdef
21@app.get("/users/", tags=["users"]) 1abcdef
22async def get_users(): 1abcdef
23 return [{"name": "Harry"}, {"name": "Ron"}] 1ghijkl
26@app.get("/items/", tags=["items"]) 1abcdef
27async def get_items(): 1abcdef
28 return [{"name": "wand"}, {"name": "flying broom"}] 1ghijkl