Commit Graph

11 Commits

Author SHA1 Message Date
pre-commit-ci-lite[bot] cef2d642de
🎨 Auto format 2025-12-28 08:37:32 +00:00
Adarsh Bennur 20c5566c2e Merge upstream/master and resolve conflict
Resolved merge conflict in test_forms_single_model.py by:
- Keeping our fix: empty input dict (issue #13399 fix)
- Adopting upstream's simpler assertion style (no IsDict)
2025-12-28 14:06:40 +05:30
Sebastián Ramírez 44c849c4fc
🔥 Remove Pydantic v1 specific test variants (#14611) 2025-12-27 19:19:10 +01:00
Sebastián Ramírez e2cd8a4201
Drop support for Pydantic v1, keeping short temporary support for Pydantic v2's `pydantic.v1` (#14575)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-20 16:55:38 +01:00
Adarsh Bennur 349c3667cf Fix: Preserve model_fields_set for Form models (issue #13399)
When using Form() with Pydantic models, FastAPI was preloading default
values and passing them to Pydantic, causing all fields to appear in
model_fields_set even when not provided. This also caused validation
to be enforced on unprovided defaults.

Changes:
- Modified _get_multidict_value() to check if values is FormData
- For FormData, return None for unprovided fields instead of defaults
- This lets Pydantic handle defaults properly and preserve fields_set
- Updated test expectation in test_forms_single_model.py
- Added comprehensive test suite in test_forms_fields_set.py

The fix ensures Form models behave consistently with JSON body models
regarding field tracking and validation.

Closes #13399
2025-12-19 18:38:39 +05:30
Sebastián Ramírez 1c4fc96c91
♻️ Upgrade internal syntax to Python 3.9+ 🎉 (#14564) 2025-12-17 21:25:59 +00:00
Motov Yurii 6cf40df24d
🐛 Fix parsing extra `Form` parameter list (#14303)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2025-12-02 05:49:32 +01:00
Nico Tonnhofer 88d4f2cb18
🐛 Fix form field regression (#12194) 2024-09-13 11:51:00 +02:00
Sebastián Ramírez 7bad7c0975
Add support for Pydantic models in `Form` parameters (#12129)
Revert "️ Temporarily revert " Add support for Pydantic models in `Form` pa…"

This reverts commit 8e6cf9ee9c.
2024-09-05 17:16:50 +02:00
Sebastián Ramírez 8e6cf9ee9c
️ Temporarily revert " Add support for Pydantic models in `Form` parameters" to make a checkpoint release (#12128)
Revert " Add support for Pydantic models in `Form` parameters (#12127)"

This reverts commit 0f3e65b007.
2024-09-05 16:55:44 +02:00
Sebastián Ramírez 0f3e65b007
Add support for Pydantic models in `Form` parameters (#12127) 2024-09-05 16:40:48 +02:00