mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-28 16:49:26 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
29 lines
693 B
Python
29 lines
693 B
Python
from fastapi import FastAPI
|
|
|
|
tags_metadata = [
|
|
{
|
|
"name": "users",
|
|
"description": "Operations with users. The **login** logic is also here.",
|
|
},
|
|
{
|
|
"name": "items",
|
|
"description": "Manage items. So _fancy_ they have their own docs.",
|
|
"externalDocs": {
|
|
"description": "Items external docs",
|
|
"url": "https://fastapi.tiangolo.com/",
|
|
},
|
|
},
|
|
]
|
|
|
|
app = FastAPI(openapi_tags=tags_metadata)
|
|
|
|
|
|
@app.get("/users/", tags=["users"])
|
|
async def get_users():
|
|
return [{"name": "Harry"}, {"name": "Ron"}]
|
|
|
|
|
|
@app.get("/items/", tags=["items"])
|
|
async def get_items():
|
|
return [{"name": "wand"}, {"name": "flying broom"}]
|