mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-18 05:15:46 -04:00
📝 Update source examples and docs from Python 3.9 to 3.10 (#14900)
This commit is contained in:
committed by
GitHub
parent
d06ab3f5c7
commit
c9e2277d8b
28
docs_src/metadata/tutorial004_py310.py
Normal file
28
docs_src/metadata/tutorial004_py310.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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"}]
|
||||
Reference in New Issue
Block a user