Browse Source

🎨 Auto format

pull/15499/head
pre-commit-ci-lite[bot] 4 weeks ago
committed by GitHub
parent
commit
e18e931a82
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      fastapi/_compat/v2.py

10
fastapi/_compat/v2.py

@ -202,7 +202,10 @@ class ModelField:
) -> Any:
# What calls this code passes a value that already called
# self._type_adapter.validate_python(value)
if polymorphic_serialization and shared.PYDANTIC_VERSION_MINOR_TUPLE < (2, 13): # pragma: no cover
if polymorphic_serialization and shared.PYDANTIC_VERSION_MINOR_TUPLE < (
2,
13,
): # pragma: no cover
raise ValueError(
"polymorphic_serialization requires Pydantic >= 2.13. "
f"Current version: {shared.PYDANTIC_VERSION}" # type: ignore[attr-defined] # ty: ignore[unused-ignore-comment]
@ -237,7 +240,10 @@ class ModelField:
# This uses Pydantic's dump_json() which serializes directly to JSON
# bytes in one pass (via Rust), avoiding the intermediate Python dict
# step of dump_python(mode="json") + json.dumps().
if polymorphic_serialization and shared.PYDANTIC_VERSION_MINOR_TUPLE < (2, 13): # pragma: no cover
if polymorphic_serialization and shared.PYDANTIC_VERSION_MINOR_TUPLE < (
2,
13,
): # pragma: no cover
raise ValueError(
"polymorphic_serialization requires Pydantic >= 2.13. "
f"Current version: {shared.PYDANTIC_VERSION}" # type: ignore[attr-defined] # ty: ignore[unused-ignore-comment]

Loading…
Cancel
Save