Skip to content

Releases: fastapi/fastapi

0.115.5

12 Nov 16:15
Compare
Choose a tag to compare

Refactors

  • ♻️ Update internal checks to support Pydantic 2.10. PR #12914 by @tiangolo.

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 ...
Read more

0.115.4

27 Oct 21:59
Compare
Choose a tag to compare

Refactors

  • ♻️ Update logic to import and check python-multipart for compatibility with newer version. PR #12627 by @tiangolo.

Docs

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

0.115.3

22 Oct 14:28
Compare
Choose a tag to compare

Upgrades

  • ⬆️ Upgrade Starlette to >=0.40.0,<0.42.0. PR #12469 by @defnull.

Docs

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

0.115.2

12 Oct 10:01
Compare
Choose a tag to compare

Upgrades

0.115.1

12 Oct 09:52
Compare
Choose a tag to compare

Fixes

  • 🐛 Fix openapi generation with responses kwarg. PR #10895 by @flxdot.
  • 🐛 Remove Required shadowing from fastapi using Pydantic v2. PR #12197 by @pachewise.

Refactors

  • ♻️ Update type annotations for improved python-multipart. PR #12407 by @tiangolo.

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 for mdx_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

0.115.0

17 Sep 19:17
Compare
Choose a tag to compare

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

0.114.2

13 Sep 20:47
Compare
Choose a tag to compare

Fixes

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

  • 💡 Add comments with instructions for Playwright screenshot scripts. PR #12193 by @tiangolo.
  • ➕ Add inline-snapshot for tests. PR #12189 by @tiangolo.

0.114.1

11 Sep 07:47
Compare
Choose a tag to compare

Refactors

  • ⚡️ Improve performance in request body parsing with a cache for internal model fields. PR #12184 by @tiangolo.

Docs

  • 📝 Remove duplicate line in docs for docs/en/docs/environment-variables.md. PR #12169 by @prometek.

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

0.114.0

06 Sep 17:42
Compare
Choose a tag to compare

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

  • ✨ Add support for forbidding extra form fields with Pydantic models. PR #12134 by @tiangolo.

Docs

  • 📝 Update docs, Form Models section title, to match config name. PR #12152 by @tiangolo.

Internal

  • ✅ Update internal tests for latest Pydantic, including CI tweaks to install the latest Pydantic. PR #12147 by @tiangolo.

0.113.0

05 Sep 15:32
Compare
Choose a tag to compare

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.

Features

  • ✨ Add support for Pydantic models in Form parameters. PR #12129 by @tiangolo.

Internal