You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Adarsh Bennur
b82e39d665
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
6 months ago
..
_compat
💡 Update comment for Pydantic internals (#14814)
4 months ago
dependencies
Fix: Preserve model_fields_set for Form models (issue #13399)
4 months ago
middleware
📝 Use `WSGIMiddleware` from `a2wsgi` instead of deprecated `fastapi.middleware.wsgi.WSGIMiddleware` (#14756)
4 months ago
openapi
🐛 Update `ValidationError` schema to include `input` and `ctx` (#14791)
4 months ago
security
🐛 Strip whitespaces from `Authorization` header credentials (#14786)
4 months ago
__init__.py
🔖 Release version 0.128.3
4 months ago
__main__.py
♻️ Add support for `pip install "fastapi[standard]"` with standard dependencies and `python -m fastapi` (#11935)
2 years ago
applications.py
📝 Add links to related sections of docs to docstrings (#14776)
4 months ago
background.py
♻️ Upgrade internal syntax to Python 3.9+ 🎉 (#14564)
6 months ago
cli.py
♻️ Add support for `pip install "fastapi[standard]"` with standard dependencies and `python -m fastapi` (#11935)
2 years ago
concurrency.py
♻️ Upgrade internal syntax to Python 3.9+ 🎉 (#14564)
6 months ago
datastructures.py
➖ Drop support for `pydantic.v1` (#14609)
5 months ago
encoders.py
🎨 Tweak types for mypy (#14816)
4 months ago
exception_handlers.py
⬆️ Upgrade Starlette supported version range to >=0.40.0,<0.49.0 (#14077)
9 months ago
exceptions.py
📝 Add links to related sections of docs to docstrings (#14776)
4 months ago
logger.py
🔊 Refactor logging (#781)
7 years ago
param_functions.py
📝 Add links to related sections of docs to docstrings (#14776)
4 months ago
params.py
➖ Drop support for `pydantic.v1` (#14609)
5 months ago
py.typed
✨ add py.typed to ship typing information (#209)
7 years ago
requests.py
⬆ Require Pydantic > 1.0 (#1862)
6 years ago
responses.py
✨ Add reference (code API) docs with PEP 727, add subclass with custom docstrings for `BackgroundTasks`, refactor docs structure (#10392)
3 years ago
routing.py
♻️ Re-implement `on_event` in FastAPI for compatibility with the next Starlette, while keeping backwards compatibility (#14851)
4 months ago
staticfiles.py
✨ Improve type annotations, add support for mypy --strict, internally and for external packages (#2547)
6 years ago
templating.py
✨ Improve type annotations, add support for mypy --strict, internally and for external packages (#2547)
6 years ago
testclient.py
✨ Improve type annotations, add support for mypy --strict, internally and for external packages (#2547)
6 years ago
types.py
🏷️ Re-export `IncEx` type from Pydantic instead of duplicating it (#14641)
4 months ago
utils.py
👷 Run mypy by pre-commit (#14806)
4 months ago
websockets.py
✨ Export `WebSocketState` in `fastapi.websockets` (#4376)
4 years ago