Roberto Bertó
b19ef4b70e
fix(compat): ensure v1.ModelField gets proper BaseConfig
- add fallback to _get_v1().BaseConfig when model_config is None
- prevents AttributeError: 'NoneType' object has no attribute 'prepare_field'
9 months ago
Roberto Bertó
7b8992ab4b
fix(compat): route v1/v2 ModelField correctly; expose schema error; harden v2 fallback
- add shared.is_v1_field_info() helper and use it in create_model_field
- build v1_kwargs / v2_kwargs separately; avoid constructing v2 FieldInfo in v1 path
- v2.ModelField: fallback to Any when field_info.annotation is absent (v1 FieldInfo)
- expose PydanticSchemaGenerationError in v1 bridge (map to ConfigError on v1)
- keep stubs minimal (.pyi) and py38-compatible (typing.*)
9 months ago
pre-commit-ci[bot]
dbd8bf0054
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
9 months ago
Roberto Bertó
803def91e4
fix: handle v1.FieldInfo.annotation compatibility in v2.ModelField
- Add defensive check for field_info.annotation attribute
- v1.FieldInfo does not have .annotation (only v2 does)
- Use getattr() with fallback to avoid AttributeError
- Add try/catch around TypeAdapter creation for robustness
- Resolves AttributeError when bridging v1->v2 FieldInfo
9 months ago
pre-commit-ci[bot]
b91a88a983
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
9 months ago
Roberto Bertó
fb00f2679d
fix: complete Python 3.8 compatibility fixes
- Fix tuple[Type[Any], ...] to Tuple[Type[Any], ...] in shared.py
- Add missing _is_model_field function to v2.py
- All tests now pass on Python 3.8 without TypeError
- Import-time compatibility fully restored for Python 3.8
9 months ago
Roberto Bertó
db9cc165b6
fix: replace built-in generics with typing.* for Python 3.8 compatibility
- Replace dict[str, Any] with Dict[str, Any] in runtime aliases
- Fix JsonSchemaValue aliases in _compat/__init__.py and _compat/v1.py
- Add Dict import to _compat/__init__.py
- Resolves TypeError: 'type' object is not subscriptable in Python 3.8
- Maintains compatibility with Python 3.8+ while keeping modern syntax in main code
9 months ago
Roberto Bertó
24835120ba
fix: use Python 3.8 compatible type annotations in stubs
- Replace modern type syntax (dict[str, Any]) with legacy syntax (Dict[str, Any])
- Add UP006 exceptions for .pyi files to allow legacy syntax for Python 3.8 compatibility
- Fixes TypeError: 'type' object is not subscriptable in Python 3.8 tests
- Maintains compatibility with Python 3.8+ while keeping modern syntax in main code
9 months ago
pre-commit-ci[bot]
8d91a59494
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
9 months ago
Roberto Bertó
2f99189cb5
feat: implement PR-clean Pydantic v1/v2 compatibility layer
- Add minimal type stubs (.pyi) for v1/v2 compatibility without runtime changes
- Move proxy imports to top-level for safe lazy loading (no PLC0415 needed)
- Remove broad type ignores and implement targeted fixes:
* Early returns for union-attr errors
* -> Any annotations for dynamic helpers
* cast() for v1/v2 bridging
* TYPE_CHECKING for type-only imports
- Fix Portuguese comments and ensure English-only codebase
- Add I001 exception in pyproject.toml for conditional imports
- Achieve 0 Ruff errors, 0 MyPy errors, all tests passing
- Maintain full Pydantic v1/v2 compatibility with lazy loading
9 months ago
Marcelo Trylesinski
dde7bd1ceb
📝 Replace `starlette.io` by `starlette.dev` and `uvicorn.org` by `uvicorn.dev` ( #14176 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
10 months ago
Sebastián Ramírez
2e721e1b02
🔖 Release version 0.119.0
10 months ago
Sebastián Ramírez
d34918abf0
✨ Add support for `from pydantic.v1 import BaseModel`, mixed Pydantic v1 and v2 models in the same app ( #14168 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
10 months ago
Sebastián Ramírez
352dbefc63
🔖 Release version 0.118.3
10 months ago
Sebastián Ramírez
942fce394b
🔖 Release version 0.118.2
10 months ago
François Voron
185cecd891
🐛 Fix tagged discriminated union not recognized as body field ( #12942 )
Co-authored-by: Motov Yurii <[email protected] >
Co-authored-by: Patrick Arminio <[email protected] >
Co-authored-by: Sebastián Ramírez <[email protected] >
10 months ago
Sebastián Ramírez
01be148429
🔖 Release version 0.118.1
10 months ago
Colin Watson
c970d8a735
👽 ️ Ensure compatibility with Pydantic 2.12.0 ( #14036 )
Co-authored-by: Sofie Van Landeghem <[email protected] >
Co-authored-by: Victorien <[email protected] >
Co-authored-by: svlandeg <[email protected] >
Co-authored-by: Motov Yurii <[email protected] >
Co-authored-by: Patrick Arminio <[email protected] >
10 months ago
Sebastián Ramírez
333f1ba737
🔖 Release version 0.118.0
10 months ago
Sebastián Ramírez
e329d78f86
🐛 Fix support for `StreamingResponse`s with dependencies with `yield` or `UploadFile`s, close after the response is done ( #14099 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
10 months ago
alv2017
3eb2ee7510
✏️ Fix typos in OAuth2 password request forms ( #14112 )
Fixed typos in OAuth2PasswordRequestForm and in OAuth2PasswordRequestFormStrict
10 months ago
Sebastián Ramírez
784f06cb9b
🔖 Release version 0.117.1
10 months ago
Thomas LÉVEIL
44fc67632b
🐛 Fix validation error when `File` is declared after `Form` parameter ( #11194 )
Co-authored-by: Sebastián Ramírez <[email protected] >
10 months ago
Sebastián Ramírez
382d083e26
🔖 Release version 0.117.0
10 months ago
vvanglro
f1e6f978ce
⚡ ️ Fix `default_factory` for response model field with Pydantic V1 ( #9704 )
Co-authored-by: Motov Yurii <[email protected] >
10 months ago
Robert Hofer
b51ec36f2e
✨ Allow `None` as return type for bodiless responses ( #9425 )
Co-authored-by: Sebastián Ramírez <[email protected] >
10 months ago
Max McLennan
86e515784d
🐛 Fix inconsistent processing of model docstring formfeed char with Pydantic V1 ( #6039 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yurii Motov <[email protected] >
Co-authored-by: Sebastián Ramírez <[email protected] >
10 months ago
Salim Aboubacar
2dc769b121
🐛 Fix `jsonable_encoder` alters `json_encoders` of Pydantic v1 objects ( #4972 )
Co-authored-by: Sebastián Ramírez <[email protected] >
Co-authored-by: Yurii Motov <[email protected] >
10 months ago
sammasak
8ede27223e
✨ Allow array values for OpenAPI schema `type` field ( #13639 )
Co-authored-by: Lukas Rajala <[email protected] >
Co-authored-by: dlax <[email protected] >
Co-authored-by: Motov Yurii <[email protected] >
Co-authored-by: Sebastián Ramírez <[email protected] >
10 months ago
Evgeny Bokshitsky
c2c6049b8f
♻️ Create `dependency-cache` dict in `solve_dependencies` only if `None` (don't re-create if empty) ( #13689 )
10 months ago
rmawatson
9ac56c70f2
🐛 Reenable `allow_arbitrary_types` when only 1 argument is used on the API endpoint ( #13694 )
Co-authored-by: Sofie Van Landeghem <[email protected] >
Co-authored-by: Motov Yurii <[email protected] >
10 months ago
Carlos Mario Toro
bc5013cd56
✨ Add OpenAPI `external_docs` parameter to `FastAPI` ( #13713 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Motov Yurii <[email protected] >
10 months ago
secrett2633
c831cdbde2
🐛 Fix `inspect.getcoroutinefunction()` can break testing with `unittest.mock.patch()` ( #14022 )
10 months ago
Sofie Van Landeghem
fe4542279d
🚨 Install pydantic.mypy plugin ( #14081 )
10 months ago
Tamir Duberstein
a95e91e46e
⬆️ Update mypy to 1.14.1 ( #12970 )
Co-authored-by: Motov Yurii <[email protected] >
Co-authored-by: Sofie Van Landeghem <[email protected] >
Co-authored-by: svlandeg <[email protected] >
Co-authored-by: svlandeg <[email protected] >
10 months ago
Sebastián Ramírez
a372edf7e8
🔖 Release version 0.116.2
10 months ago
Ben Beasley
7563579dc8
⬆️ Upgrade Starlette supported version range to >=0.40.0,<0.49.0 ( #14077 )
Co-authored-by: svlandeg <[email protected] >
10 months ago
Sebastián Ramírez
313723494b
🔖 Release version 0.116.1
1 year ago
Sebastián Ramírez
cad6880fd9
⬆️ Upgrade Starlette supported version range to `>=0.40.0,<0.48.0` ( #13884 )
1 year ago
Sebastián Ramírez
bd8f358fd9
🔖 Release version 0.116.0
1 year ago
Sebastián Ramírez
ebdeda2de6
🔖 Release version 0.115.14
1 year ago
Patrick Arminio
9d0d8828cc
🐛 Fix support for unions when using `Form` ( #13827 )
1 year ago
Sebastián Ramírez
4734df1db8
🔖 Release version 0.115.13
1 year ago
Gabriel
dfe9dde982
📝 Add annotations to HTTP middleware example ( #11530 )
Co-authored-by: Sofie Van Landeghem <[email protected] >
Co-authored-by: Sebastián Ramírez <[email protected] >
1 year ago
Salar Nosrati-Ershad
aebff5006f
✨ Add `refreshUrl` parameter in `OAuth2PasswordBearer` ( #11460 )
Co-authored-by: Salar Nosrati-Ershad <[email protected] >
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alejandra <[email protected] >
Co-authored-by: Motov Yurii <[email protected] >
1 year ago
oogee
30b9dfb11c
🚸 Set format to password for fields `password` and `client_secret` in `OAuth2PasswordRequestForm`, make docs show password fields for passwords ( #11032 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 year ago
Peter
b4524145e6
✏️ Fix typo in docstring ( #13532 )
1 year ago
Timon
97fdbdd0d8
📝 Update exclude-parameters-from-openapi documentation links ( #13600 )
1 year ago
Motov Yurii
535d5b3f9f
🐛 Fix truncating the model's description with form feed (`\f`) character for Pydantic V2 ( #13698 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 year ago
Joakim Nordling
8fa56b46a1
⬆️ Update ReDoc to version 2.x ( #9700 )
Co-authored-by: svlandeg <[email protected] >
Co-authored-by: Sebastián Ramírez <[email protected] >
Co-authored-by: Sofie Van Landeghem <[email protected] >
1 year ago