Closed renovate[bot] closed 2 months ago
This PR contains the following updates:
^0.114.0
^0.115.0
π Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
π¦ Automerge: Enabled.
β» Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.
Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in:
This PR contains the following updates:
^0.114.0
->^0.115.0
Release Notes
fastapi/fastapi (fastapi)
### [`v0.115.0`](https://redirect.github.com/fastapi/fastapi/releases/tag/0.115.0) [Compare Source](https://redirect.github.com/fastapi/fastapi/compare/0.114.2...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: ```python 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](https://fastapi.tiangolo.com/tutorial/query-param-models/). ##### `Header` Parameter Models Use Pydantic models for `Header` parameters: ```python 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](https://fastapi.tiangolo.com/tutorial/header-param-models/). ##### `Cookie` Parameter Models Use Pydantic models for `Cookie` parameters: ```python 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](https://fastapi.tiangolo.com/tutorial/cookie-param-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"}`: ```python 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: - [Forbid Extra Query Parameters](https://fastapi.tiangolo.com/tutorial/query-param-models/#forbid-extra-query-parameters) - [Forbid Extra Headers](https://fastapi.tiangolo.com/tutorial/header-param-models/#forbid-extra-headers) - [Forbid Extra Cookies](https://fastapi.tiangolo.com/tutorial/cookie-param-models/#forbid-extra-cookies) ##### Features - β¨ Add support for Pydantic models for parameters using `Query`, `Cookie`, `Header`. PR [#12199](https://redirect.github.com/fastapi/fastapi/pull/12199) by [@tiangolo](https://redirect.github.com/tiangolo). ##### Translations - π Add Portuguese translation for `docs/pt/docs/advanced/security/http-basic-auth.md`. PR [#12195](https://redirect.github.com/fastapi/fastapi/pull/12195) by [@ceb10n](https://redirect.github.com/ceb10n). ##### Internal - β¬ \[pre-commit.ci] pre-commit autoupdate. PR [#12204](https://redirect.github.com/fastapi/fastapi/pull/12204) by [@pre-commit-ci\[bot\]](https://redirect.github.com/apps/pre-commit-ci). ### [`v0.114.2`](https://redirect.github.com/fastapi/fastapi/releases/tag/0.114.2) [Compare Source](https://redirect.github.com/fastapi/fastapi/compare/0.114.1...0.114.2) ##### Fixes - π Fix form field regression with `alias`. PR [#12194](https://redirect.github.com/fastapi/fastapi/pull/12194) by [@Wurstnase](https://redirect.github.com/Wurstnase). ##### Translations - π Add Portuguese translation for `docs/pt/docs/tutorial/request-form-models.md`. PR [#12175](https://redirect.github.com/fastapi/fastapi/pull/12175) by [@ceb10n](https://redirect.github.com/ceb10n). - π Add Chinese translation for `docs/zh/docs/project-generation.md`. PR [#12170](https://redirect.github.com/fastapi/fastapi/pull/12170) by [@waketzheng](https://redirect.github.com/waketzheng). - π Add Dutch translation for `docs/nl/docs/python-types.md`. PR [#12158](https://redirect.github.com/fastapi/fastapi/pull/12158) by [@maxscheijen](https://redirect.github.com/maxscheijen). ##### Internal - π‘ Add comments with instructions for Playwright screenshot scripts. PR [#12193](https://redirect.github.com/fastapi/fastapi/pull/12193) by [@tiangolo](https://redirect.github.com/tiangolo). - β Add inline-snapshot for tests. PR [#12189](https://redirect.github.com/fastapi/fastapi/pull/12189) by [@tiangolo](https://redirect.github.com/tiangolo).Configuration
π Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
π¦ Automerge: Enabled.
β» Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.
Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: