Features
- ✨ Add support for function return type annotations to declare the
response_model
. Initial PR #1436 by @uriyyo.
Now you can declare the return type / response_model
in the function return type annotation:
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
@app.get("/items/")
async def read_items() -> list[Item]:
return [
Item(name="Portal Gun", price=42.0),
Item(name="Plumbus", price=32.0),
]
FastAPI will use the return type annotation to perform:
- Data validation
- Automatic documentation
- It could power automatic client generators
- Data filtering
Before this version it was only supported via the response_model
parameter.
Read more about it in the new docs: Response Model - Return Type.
Docs
- 📝 Add External Link: Authorization on FastAPI with Casbin. PR #5712 by @Xhy-5000.
- ✏ Fix typo in
docs/en/docs/async.md
. PR #5785 by @Kingdageek. - ✏ Fix typo in
docs/en/docs/deployment/concepts.md
. PR #5824 by @kelbyfaessler.
Translations
- 🌐 Add Russian translation for
docs/ru/docs/fastapi-people.md
. PR #5577 by @Xewus. - 🌐 Fix typo in Chinese translation for
docs/zh/docs/benchmarks.md
. PR #4269 by @15027668g. - 🌐 Add Korean translation for
docs/tutorial/cors.md
. PR #3764 by @NinaHwang.
Internal
- ⬆ Update coverage[toml] requirement from <7.0,>=6.5.0 to >=6.5.0,<8.0. PR #5801 by @dependabot[bot].
- ⬆ Update uvicorn[standard] requirement from <0.19.0,>=0.12.0 to >=0.12.0,<0.21.0 for development. PR #5795 by @dependabot[bot].
- ⬆ Bump dawidd6/action-download-artifact from 2.24.2 to 2.24.3. PR #5842 by @dependabot[bot].
- 👥 Update FastAPI People. PR #5825 by @github-actions[bot].
- ⬆ Bump types-ujson from 5.5.0 to 5.6.0.0. PR #5735 by @dependabot[bot].
- ⬆ Bump pypa/gh-action-pypi-publish from 1.5.2 to 1.6.4. PR #5750 by @dependabot[bot].
- 👷 Add GitHub Action gate/check. PR #5492 by @webknjaz.
- 🔧 Update sponsors, add Svix. PR #5848 by @tiangolo.
- 🔧 Remove Doist sponsor. PR #5847 by @tiangolo.
- ⬆ Update sqlalchemy requirement from <=1.4.41,>=1.3.18 to >=1.3.18,<1.4.43. PR #5540 by @dependabot[bot].
- ⬆ Bump nwtgck/actions-netlify from 1.2.4 to 2.0.0. PR #5757 by @dependabot[bot].
- 👷 Refactor CI artifact upload/download for docs previews. PR #5793 by @tiangolo.
- ⬆ Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.5.2. PR #5714 by @dependabot[bot].
- 👥 Update FastAPI People. PR #5722 by @github-actions[bot].
- 🔧 Update sponsors, disable course bundle. PR #5713 by @tiangolo.
- ⬆ Update typer[all] requirement from <0.7.0,>=0.6.1 to >=0.6.1,<0.8.0. PR #5639 by @dependabot[bot].