Sync fastapi docs from 50fa3f7c on 2026-01-11

This commit is contained in:
The Librarian
2026-01-11 04:00:07 +00:00
parent a42b1ff04e
commit 95d1a394e6
1611 changed files with 12193 additions and 123004 deletions
@@ -0,0 +1,28 @@
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str | None = None
price: float
tax: float | None = None
tags: set[str] = set()
@app.post("/items/", response_model=Item, summary="Create an item")
async def create_item(item: Item):
"""
Create an item with all the information:
- **name**: each item must have a name
- **description**: a long description
- **price**: required
- **tax**: if the item doesn't have tax, you can omit this
- **tags**: a set of unique tag strings for this item
\f
:param item: User input.
"""
return item
@@ -1,4 +1,4 @@
from typing import Set, Union
from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
@@ -11,7 +11,7 @@ class Item(BaseModel):
description: Union[str, None] = None
price: float
tax: Union[float, None] = None
tags: Set[str] = set()
tags: set[str] = set()
@app.post("/items/", response_model=Item, summary="Create an item")
@@ -1,15 +1,13 @@
from typing import List
import yaml
from fastapi import FastAPI, HTTPException, Request
from pydantic import BaseModel, ValidationError
from pydantic.v1 import BaseModel, ValidationError
app = FastAPI()
class Item(BaseModel):
name: str
tags: List[str]
tags: list[str]
@app.post(
@@ -1,5 +1,3 @@
from typing import List
import yaml
from fastapi import FastAPI, HTTPException, Request
from pydantic import BaseModel, ValidationError
@@ -9,7 +7,7 @@ app = FastAPI()
class Item(BaseModel):
name: str
tags: List[str]
tags: list[str]
@app.post(