fastapi/fastapi (fastapi)
### [`v0.114.0`](https://redirect.github.com/fastapi/fastapi/releases/tag/0.114.0)
[Compare Source](https://redirect.github.com/fastapi/fastapi/compare/0.113.0...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"}`:
```python
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](https://fastapi.tiangolo.com/tutorial/request-form-models/#forbid-extra-form-fields).
##### Features
- ✨ Add support for forbidding extra form fields with Pydantic models. PR [#12134](https://redirect.github.com/fastapi/fastapi/pull/12134) by [@tiangolo](https://redirect.github.com/tiangolo).
##### Docs
- 📝 Update docs, Form Models section title, to match config name. PR [#12152](https://redirect.github.com/fastapi/fastapi/pull/12152) by [@tiangolo](https://redirect.github.com/tiangolo).
##### Internal
- ✅ Update internal tests for latest Pydantic, including CI tweaks to install the latest Pydantic. PR [#12147](https://redirect.github.com/fastapi/fastapi/pull/12147) 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.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
0.113.0
->0.114.0
Release Notes
fastapi/fastapi (fastapi)
### [`v0.114.0`](https://redirect.github.com/fastapi/fastapi/releases/tag/0.114.0) [Compare Source](https://redirect.github.com/fastapi/fastapi/compare/0.113.0...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"}`: ```python 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](https://fastapi.tiangolo.com/tutorial/request-form-models/#forbid-extra-form-fields). ##### Features - ✨ Add support for forbidding extra form fields with Pydantic models. PR [#12134](https://redirect.github.com/fastapi/fastapi/pull/12134) by [@tiangolo](https://redirect.github.com/tiangolo). ##### Docs - 📝 Update docs, Form Models section title, to match config name. PR [#12152](https://redirect.github.com/fastapi/fastapi/pull/12152) by [@tiangolo](https://redirect.github.com/tiangolo). ##### Internal - ✅ Update internal tests for latest Pydantic, including CI tweaks to install the latest Pydantic. PR [#12147](https://redirect.github.com/fastapi/fastapi/pull/12147) 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.