Debian Codegraph @

docs_src/metadata/tutorial004_py310.py

raw
1 from fastapi import FastAPI
2
3 tags_metadata = [
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 ]
17
18 app = FastAPI(openapi_tags=tags_metadata)
19
20
21 @app.get("/users/", tags=["users"])
22 async def get_users():
23 return [{"name": "Harry"}, {"name": "Ron"}]
24
25
26 @app.get("/items/", tags=["items"])
27 async def get_items():
28 return [{"name": "wand"}, {"name": "flying broom"}]