Releases: fastapi/fastapi
0.115.5
Refactors
Docs
- 📝 Update includes for
docs/en/docs/tutorial/body.md
. PR #12757 by @gsheni. - 📝 Update includes in
docs/en/docs/advanced/testing-dependencies.md
. PR #12647 by @AyushSinghal1794. - 📝 Update includes for
docs/en/docs/tutorial/metadata.md
. PR #12773 by @Nimitha-jagadeesha. - 📝 Update
docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
. PR #12045 by @xuvjso. - 📝 Update includes for
docs/en/docs/tutorial/dependencies/global-dependencies.md
. PR #12653 by @vishnuvskvkl. - 📝 Update includes for
docs/en/docs/tutorial/body-updates.md
. PR #12712 by @davioc. - 📝 Remove mention of Celery in the project generators. PR #12742 by @david-caro.
- 📝 Update includes in
docs/en/docs/tutorial/header-param-models.md
. PR #12814 by @zhaohan-dong. - 📝 Update
contributing.md
docs, include note to not translate this page. PR #12841 by @tiangolo. - 📝 Update includes in
docs/en/docs/tutorial/request-forms.md
. PR #12648 by @vishnuvskvkl. - 📝 Update includes in
docs/en/docs/tutorial/request-form-models.md
. PR #12649 by @vishnuvskvkl. - 📝 Update includes in
docs/en/docs/tutorial/security/oauth2-jwt.md
. PR #12650 by @OCE1960. - 📝 Update includes in
docs/vi/docs/tutorial/first-steps.md
. PR #12754 by @MxPy. - 📝 Update includes for
docs/pt/docs/advanced/wsgi.md
. PR #12769 by @Nimitha-jagadeesha. - 📝 Update includes for
docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
. PR #12815 by @handabaldeep. - 📝 Update includes for
docs/en/docs/tutorial/dependencies/classes-as-dependencies.md
. PR #12813 by @handabaldeep. - ✏️ Fix error in
docs/en/docs/tutorial/middleware.md
. PR #12819 by @alejsdev. - 📝 Update includes for
docs/en/docs/tutorial/security/get-current-user.md
. PR #12645 by @OCE1960. - 📝 Update includes for
docs/en/docs/tutorial/security/first-steps.md
. PR #12643 by @OCE1960. - 📝 Update includes in
docs/de/docs/advanced/additional-responses.md
. PR #12821 by @zhaohan-dong. - 📝 Update includes in
docs/en/docs/advanced/generate-clients.md
. PR #12642 by @AyushSinghal1794. - 📝 Fix admonition double quotes with new syntax. PR #12835 by @tiangolo.
- 📝 Update includes in
docs/zh/docs/advanced/additional-responses.md
. PR #12828 by @zhaohan-dong. - 📝 Update includes in
docs/en/docs/tutorial/path-params-numeric-validations.md
. PR #12825 by @zhaohan-dong. - 📝 Update includes for
docs/en/docs/advanced/testing-websockets.md
. PR #12761 by @hamidrasti. - 📝 Update includes for
docs/en/docs/advanced/using-request-directly.md
. PR #12760 by @hamidrasti. - 📝 Update includes for
docs/advanced/wsgi.md
. PR #12758 by @hamidrasti. - 📝 Update includes in
docs/de/docs/tutorial/middleware.md
. PR #12729 by @paintdog. - 📝 Update includes for
docs/en/docs/tutorial/schema-extra-example.md
. PR #12822 by @tiangolo. - 📝 Update includes in
docs/fr/docs/advanced/additional-responses.md
. PR #12634 by @fegmorte. - 📝 Update includes in
docs/fr/docs/advanced/path-operation-advanced-configuration.md
. PR #12633 by @kantandane. - 📝 Update includes in
docs/fr/docs/advanced/response-directly.md
. PR #12632 by @kantandane. - 📝 Update includes for
docs/en/docs/tutorial/header-params.md
. PR #12640 by @vishnuvskvkl. - 📝 Update includes in
docs/en/docs/tutorial/cookie-param-models.md
. PR #12639 by @vishnuvskvkl. - 📝 Update includes for
docs/en/docs/tutorial/extra-models.md
. PR #12638 by @vishnuvskvkl. - 📝 Update includes for
docs/en/docs/tutorial/cors.md
. PR #12637 by @vishnuvskvkl. - 📝 Update includes for
docs/en/docs/tutorial/dependencies/sub-dependencies.md
. PR #12810 by @handabaldeep. - 📝 Update includes in
docs/en/docs/tutorial/body-nested-models.md
. PR #12812 by @zhaohan-dong. - 📝 Update includes in
docs/en/docs/tutorial/path-operation-configuration.md
. PR #12809 by @AlexWendland. - 📝 Update includes in
docs/en/docs/tutorial/request-files.md
. PR #12818 by @zhaohan-dong. - 📝 Update includes for
docs/en/docs/tutorial/query-param-models.md
. PR #12817 by @handabaldeep. - 📝 Update includes in
docs/en/docs/tutorial/path-params.md
. PR #12811 by @AlexWendland. - 📝 Update includes in
docs/en/docs/tutorial/response-model.md
. PR #12621 by @kantandane. - 📝 Update includes in
docs/en/docs/advanced/websockets.md
. PR #12606 by @vishnuvskvkl. - 📝 Updates include for
docs/en/docs/tutorial/cookie-params.md
. PR #12808 by @handabaldeep. - 📝 Update includes in
docs/en/docs/tutorial/middleware.md
. PR #12807 by @AlexWendland. - 📝 Update includes in
docs/en/docs/advanced/sub-applications.md
. PR #12806 by @zhaohan-dong. - 📝 Update includes in
docs/en/docs/advanced/response-headers.md
. PR #12805 by @zhaohan-dong. - 📝 Update includes in
docs/fr/docs/tutorial/first-steps.md
. PR #12594 by @kantandane. - 📝 Update includes in
docs/en/docs/advanced/response-cookies.md
. PR #12804 by @zhaohan-dong. - 📝 Update includes in
docs/en/docs/advanced/path-operation-advanced-configuration.md
. PR #12802 by @zhaohan-dong. - 📝 Update includes for
docs/en/docs/advanced/response-directly.md
. PR #12803 by @handabaldeep. - 📝 Update includes in
docs/zh/docs/tutorial/background-tasks.md
. PR #12798 by @zhaohan-dong. - 📝 Update includes for
docs/de/docs/tutorial/body-multiple-params.md
. PR #12699 by @alissadb. - 📝 Update includes in
docs/em/docs/tutorial/body-updates.md
. PR ...
0.115.4
Refactors
- ♻️ Update logic to import and check
python-multipart
for compatibility with newer version. PR #12627 by @tiangolo.
Docs
- 📝 Update includes in
docs/fr/docs/tutorial/body.md
. PR #12596 by @kantandane. - 📝 Update includes in
docs/fr/docs/tutorial/debugging.md
. PR #12595 by @kantandane. - 📝 Update includes in
docs/fr/docs/tutorial/query-params-str-validations.md
. PR #12591 by @kantandane. - 📝 Update includes in
docs/fr/docs/tutorial/query-params.md
. PR #12589 by @kantandane. - 📝 Update includes in
docs/en/tutorial/body-fields.md
. PR #12588 by @lucaromagnoli. - 📝 Update includes in
docs/de/docs/tutorial/response-status-code.md
. PR #12585 by @abejaranoh. - 📝 Update includes in
docs/en/docs/tutorial/body.md
. PR #12586 by @lucaromagnoli. - 📝 Update includes in
docs/en/docs/advanced/behind-a-proxy.md
. PR #12583 by @imjuanleonard. - 📝 Update includes syntax for
docs/pl/docs/tutorial/first-steps.md
. PR #12584 by @sebkozlo. - 📝 Update includes in
docs/en/docs/advanced/middleware.md
. PR #12582 by @montanarograziano. - 📝 Update includes in
docs/en/docs/advanced/additional-status-codes.md
. PR #12577 by @krishnamadhavan. - 📝 Update includes in
docs/en/docs/advanced/advanced-dependencies.md
. PR #12578 by @krishnamadhavan. - 📝 Update includes in
docs/en/docs/advanced/additional-responses.md
. PR #12576 by @krishnamadhavan. - 📝 Update includes in
docs/en/docs/tutorial/static-files.md
. PR #12575 by @lucaromagnoli. - 📝 Update includes in
docs/en/docs/advanced/async-tests.md
. PR #12568 by @krishnamadhavan. - 📝 Update includes in
docs/pt/docs/advanced/behind-a-proxy.md
. PR #12563 by @asmioglou. - 📝 Update includes in
docs/de/docs/advanced/security/http-basic-auth.md
. PR #12561 by @Nimitha-jagadeesha. - 📝 Update includes in
docs/en/docs/tutorial/background-tasks.md
. PR #12559 by @FarhanAliRaza. - 📝 Update includes in
docs/fr/docs/python-types.md
. PR #12558 by @Ismailtlem. - 📝 Update includes in
docs/en/docs/how-to/graphql.md
. PR #12564 by @philipokiokio. - 📝 Update includes in
docs/en/docs/how-to/extending-openapi.md
. PR #12562 by @philipokiokio. - 📝 Update includes for
docs/en/docs/how-to/configure-swagger-ui.md
. PR #12556 by @tiangolo. - 📝 Update includes for
docs/en/docs/how-to/separate-openapi-schemas.md
. PR #12555 by @tiangolo. - 📝 Update includes for
docs/en/docs/advanced/security/http-basic-auth.md
. PR #12553 by @tiangolo. - 📝 Update includes in
docs/en/docs/tutorial/first-steps.md
. PR #12552 by @tiangolo. - 📝 Update includes in
docs/en/docs/python-types.md
. PR #12551 by @tiangolo. - 📝 Fix link in OAuth2 docs. PR #12550 by @tiangolo.
- 📝 Add External Link: FastAPI do Zero. PR #12533 by @rennerocha.
- 📝 Fix minor typos. PR #12516 by @kkirsche.
- 🌐 Fix rendering issue in translations. PR #12509 by @alejsdev.
Translations
- 📝 Update includes in
docs/de/docs/advanced/async-tests.md
. PR #12567 by @imjuanleonard. - 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/sql-databases.md
. PR #12530 by @ilacftemp. - 🌐 Add Korean translation for
docs/ko/docs/benchmarks.md
. PR #12540 by @Limsunoh. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/separate-openapi-schemas.md
. PR #12518 by @ilacftemp. - 🌐 Update Traditional Chinese translation for
docs/zh-hant/docs/deployment/index.md
. PR #12521 by @codingjenny. - 🌐 Update Traditional Chinese translation for
docs/zh-hant/docs/deployment/cloud.md
. PR #12522 by @codingjenny. - 🌐 Update Traditional Chinese translation for
docs/zh-hant/docs/how-to/index.md
. PR #12523 by @codingjenny. - 🌐 Update Traditional Chinese translation for
docs/zh-hant/docs/tutorial/index.md
. PR #12524 by @codingjenny. - 🌐 Add Traditional Chinese translation for
docs/zh-hant/docs/how-to/index.md
. PR #12468 by @codingjenny. - 🌐 Add Traditional Chinese translation for
docs/zh-hant/docs/tutorial/index.md
. PR #12466 by @codingjenny. - 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/header-param-models.md
. PR #12437 by @Joao-Pedro-P-Holanda. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/extending-openapi.md
. PR #12470 by @ilacftemp. - 🌐 Add Portuguese translation for
docs/pt/docs/advanced/dataclasses.md
. PR #12475 by @leoscarlato. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/custom-request-and-route.md
. PR #12483 by @devfernandoa.
Internal
- ⬆ Bump cloudflare/wrangler-action from 3.9 to 3.11. PR #12544 by @dependabot[bot].
- 👷 Update GitHub Action to deploy docs previews to handle missing deploy comments. PR #12527 by @tiangolo.
- ⬆ [pre-commit.ci] pre-commit autoupdate. PR #12505 by @pre-commit-ci[bot].
0.115.3
Upgrades
Docs
- 📝 Fix broken link in docs. PR #12495 by @eltonjncorreia.
Translations
- 🌐 Add Traditional Chinese translation for
docs/zh-hant/docs/fastapi-cli.md
. PR #12444 by @codingjenny. - 🌐 Add Traditional Chinese translation for
docs/zh-hant/docs/deployment/index.md
. PR #12439 by @codingjenny. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/testing-database.md
. PR #12472 by @GuilhermeRameh. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/custom-docs-ui-assets.md
. PR #12473 by @devluisrodrigues. - 🌐 Add Portuguese translation for
docs/pt/docs/advanced/response-headers.md
. PR #12458 by @leonardopaloschi. - 🌐 Add Traditional Chinese translation for
docs/zh-hant/docs/deployment/cloud.md
. PR #12440 by @codingjenny. - 🌐 Update Portuguese translation for
docs/pt/docs/python-types.md
. PR #12428 by @ceb10n. - 🌐 Add Russian translation for
docs/ru/docs/environment-variables.md
. PR #12436 by @wisderfin. - 🌐 Add Traditional Chinese translation for
docs/zh-hant/docs/resources/index.md
. PR #12443 by @codingjenny. - 🌐 Add Traditional Chinese translation for
docs/zh-hant/docs/about/index.md
. PR #12438 by @codingjenny. - 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/query-param-models.md
. PR #12414 by @ceb10n. - 🌐 Remove Portuguese translation for
docs/pt/docs/deployment.md
. PR #12427 by @ceb10n. - 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/body-updates.md
. PR #12381 by @andersonrocha0. - 🌐 Add Portuguese translation for
docs/pt/docs/advanced/response-cookies.md
. PR #12417 by @Paulofalcao2002.
Internal
- 👷 Update issue manager workflow . PR #12457 by @alejsdev.
- 🔧 Update team, include YuriiMotov 🚀. PR #12453 by @tiangolo.
- 👷 Refactor label-approved, make it an internal script instead of an external GitHub Action. PR #12280 by @tiangolo.
- 👷 Fix smokeshow, checkout files on CI. PR #12434 by @tiangolo.
- 👷 Use uv in CI. PR #12281 by @tiangolo.
- ⬆ Update httpx requirement from <0.25.0,>=0.23.0 to >=0.23.0,<0.28.0. PR #11509 by @dependabot[bot].
0.115.2
0.115.1
Fixes
- 🐛 Fix openapi generation with responses kwarg. PR #10895 by @flxdot.
- 🐛 Remove
Required
shadowing from fastapi using Pydantic v2. PR #12197 by @pachewise.
Refactors
Docs
- ✨ Add new tutorial for SQL databases with SQLModel. PR #12285 by @tiangolo.
- 📝 Add External Link: How to profile a FastAPI asynchronous request. PR #12389 by @brouberol.
- 🔧 Remove
base_path
formdx_include
Markdown extension in MkDocs. PR #12391 by @tiangolo. - 📝 Update link to Swagger UI configuration docs. PR #12264 by @makisukurisu.
- 📝 Adding links for Playwright and Vite in
docs/project-generation.md
. PR #12274 by @kayqueGovetri. - 📝 Fix small typos in the documentation. PR #12213 by @svlandeg.
Translations
- 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/cookie-param-models.md
. PR #12298 by @ceb10n. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/graphql.md
. PR #12215 by @AnandaCampelo. - 🌐 Add Portuguese translation for
docs/pt/docs/advanced/security/oauth2-scopes.md
. PR #12263 by @ceb10n. - 🌐 Add Portuguese translation for
docs/pt/docs/deployment/concepts.md
. PR #12219 by @marcelomarkus. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/conditional-openapi.md
. PR #12221 by @marcelomarkus. - 🌐 Add Portuguese translation for
docs/pt/docs/advanced/response-directly.md
. PR #12266 by @Joao-Pedro-P-Holanda. - 🌐 Update Portuguese translation for
docs/pt/docs/tutorial/cookie-params.md
. PR #12297 by @ceb10n. - 🌐 Fix Korean translation for
docs/ko/docs/tutorial/index.md
. PR #12278 by @kkotipy. - 🌐 Update Portuguese translation for
docs/pt/docs/advanced/security/http-basic-auth.md
. PR #12275 by @andersonrocha0. - 🌐 Add Portuguese translation for
docs/pt/docs/deployment/cloud.md
. PR #12217 by @marcelomarkus. - ✏️ Fix typo in
docs/es/docs/python-types.md
. PR #12235 by @JavierSanchezCastro. - 🌐 Add Dutch translation for
docs/nl/docs/environment-variables.md
. PR #12200 by @maxscheijen. - 🌐 Add Portuguese translation for
docs/pt/docs/deployment/manually.md
. PR #12210 by @JoaoGustavoRogel. - 🌐 Add Portuguese translation for
docs/pt/docs/deployment/server-workers.md
. PR #12220 by @marcelomarkus. - 🌐 Add Portuguese translation for
docs/pt/docs/how-to/configure-swagger-ui.md
. PR #12222 by @marcelomarkus.
Internal
- ⬆ [pre-commit.ci] pre-commit autoupdate. PR #12396 by @pre-commit-ci[bot].
- 🔨 Add script to generate variants of files. PR #12405 by @tiangolo.
- 🔧 Add speakeasy-api to
sponsors_badge.yml
. PR #12404 by @tiangolo. - ➕ Add docs dependency: markdown-include-variants. PR #12399 by @tiangolo.
- 📝 Fix extra mdx-base-path paths. PR #12397 by @tiangolo.
- 👷 Tweak labeler to not override custom labels. PR #12398 by @tiangolo.
- 👷 Update worfkow deploy-docs-notify URL. PR #12392 by @tiangolo.
- 👷 Update Cloudflare GitHub Action. PR #12387 by @tiangolo.
- ⬆ Bump pypa/gh-action-pypi-publish from 1.10.1 to 1.10.3. PR #12386 by @dependabot[bot].
- ⬆ Bump mkdocstrings[python] from 0.25.1 to 0.26.1. PR #12371 by @dependabot[bot].
- ⬆ Bump griffe-typingdoc from 0.2.6 to 0.2.7. PR #12370 by @dependabot[bot].
- ⬆ [pre-commit.ci] pre-commit autoupdate. PR #12331 by @pre-commit-ci[bot].
- 🔧 Update sponsors, remove Fine.dev. PR #12271 by @tiangolo.
- ⬆ [pre-commit.ci] pre-commit autoupdate. PR #12253 by @pre-commit-ci[bot].
- ✏️ Fix docstring typos in http security. PR #12223 by @albertvillanova.
0.115.0
Highlights
Now you can declare Query
, Header
, and Cookie
parameters with Pydantic models. 🎉
Query
Parameter Models
Use Pydantic models for Query
parameters:
from typing import Annotated, Literal
from fastapi import FastAPI, Query
from pydantic import BaseModel, Field
app = FastAPI()
class FilterParams(BaseModel):
limit: int = Field(100, gt=0, le=100)
offset: int = Field(0, ge=0)
order_by: Literal["created_at", "updated_at"] = "created_at"
tags: list[str] = []
@app.get("/items/")
async def read_items(filter_query: Annotated[FilterParams, Query()]):
return filter_query
Read the new docs: Query Parameter Models.
Header
Parameter Models
Use Pydantic models for Header
parameters:
from typing import Annotated
from fastapi import FastAPI, Header
from pydantic import BaseModel
app = FastAPI()
class CommonHeaders(BaseModel):
host: str
save_data: bool
if_modified_since: str | None = None
traceparent: str | None = None
x_tag: list[str] = []
@app.get("/items/")
async def read_items(headers: Annotated[CommonHeaders, Header()]):
return headers
Read the new docs: Header Parameter Models.
Cookie
Parameter Models
Use Pydantic models for Cookie
parameters:
from typing import Annotated
from fastapi import Cookie, FastAPI
from pydantic import BaseModel
app = FastAPI()
class Cookies(BaseModel):
session_id: str
fatebook_tracker: str | None = None
googall_tracker: str | None = None
@app.get("/items/")
async def read_items(cookies: Annotated[Cookies, Cookie()]):
return cookies
Read the new docs: Cookie Parameter Models.
Forbid Extra Query (Cookie, Header) Parameters
Use Pydantic models to restrict extra values for Query
parameters (also applies to Header
and Cookie
parameters).
To achieve it, use Pydantic's model_config = {"extra": "forbid"}
:
from typing import Annotated, Literal
from fastapi import FastAPI, Query
from pydantic import BaseModel, Field
app = FastAPI()
class FilterParams(BaseModel):
model_config = {"extra": "forbid"}
limit: int = Field(100, gt=0, le=100)
offset: int = Field(0, ge=0)
order_by: Literal["created_at", "updated_at"] = "created_at"
tags: list[str] = []
@app.get("/items/")
async def read_items(filter_query: Annotated[FilterParams, Query()]):
return filter_query
This applies to Query
, Header
, and Cookie
parameters, read the new docs:
Features
- ✨ Add support for Pydantic models for parameters using
Query
,Cookie
,Header
. PR #12199 by @tiangolo.
Translations
- 🌐 Add Portuguese translation for
docs/pt/docs/advanced/security/http-basic-auth.md
. PR #12195 by @ceb10n.
Internal
- ⬆ [pre-commit.ci] pre-commit autoupdate. PR #12204 by @pre-commit-ci[bot].
0.114.2
Fixes
- 🐛 Fix form field regression with
alias
. PR #12194 by @Wurstnase.
Translations
- 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/request-form-models.md
. PR #12175 by @ceb10n. - 🌐 Add Chinese translation for
docs/zh/docs/project-generation.md
. PR #12170 by @waketzheng. - 🌐 Add Dutch translation for
docs/nl/docs/python-types.md
. PR #12158 by @maxscheijen.
Internal
0.114.1
Refactors
- ⚡️ Improve performance in request body parsing with a cache for internal model fields. PR #12184 by @tiangolo.
Docs
Translations
- 🌐 Add Portuguese translation for
docs/pt/docs/virtual-environments.md
. PR #12163 by @marcelomarkus. - 🌐 Add Portuguese translation for
docs/pt/docs/environment-variables.md
. PR #12162 by @marcelomarkus. - 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/testing.md
. PR #12164 by @marcelomarkus. - 🌐 Add Portuguese translation for
docs/pt/docs/tutorial/debugging.md
. PR #12165 by @marcelomarkus. - 🌐 Add Korean translation for
docs/ko/docs/project-generation.md
. PR #12157 by @BORA040126.
Internal
- ⬆ Bump tiangolo/issue-manager from 0.5.0 to 0.5.1. PR #12173 by @dependabot[bot].
- ⬆ [pre-commit.ci] pre-commit autoupdate. PR #12176 by @pre-commit-ci[bot].
- 👷 Update
issue-manager.yml
. PR #12159 by @tiangolo. - ✏️ Fix typo in
fastapi/params.py
. PR #12143 by @surreal30.
0.114.0
You can restrict form fields to only include those declared in a Pydantic model and forbid any extra field sent in the request using Pydantic's model_config = {"extra": "forbid"}
:
from typing import Annotated
from fastapi import FastAPI, Form
from pydantic import BaseModel
app = FastAPI()
class FormData(BaseModel):
username: str
password: str
model_config = {"extra": "forbid"}
@app.post("/login/")
async def login(data: Annotated[FormData, Form()]):
return data
Read the new docs: Form Models - Forbid Extra Form Fields.
Features
Docs
Internal
0.113.0
Now you can declare form fields with Pydantic models:
from typing import Annotated
from fastapi import FastAPI, Form
from pydantic import BaseModel
app = FastAPI()
class FormData(BaseModel):
username: str
password: str
@app.post("/login/")
async def login(data: Annotated[FormData, Form()]):
return data
Read the new docs: Form Models.