Browse Source

Dump all types of models

pull/14582/head
johnslavik 7 months ago
parent
commit
adfcc1c8a6
Failed to extract signature
  1. 3
      fastapi/routing.py

3
fastapi/routing.py

@ -29,6 +29,7 @@ from fastapi._compat import (
_model_dump,
_normalize_errors,
lenient_issubclass,
may_v1,
)
from fastapi.datastructures import Default, DefaultPlaceholder
from fastapi.dependencies.models import Dependant
@ -152,7 +153,7 @@ def _prepare_response_content(
exclude_defaults: bool = False,
exclude_none: bool = False,
) -> Any:
if isinstance(res, BaseModel):
if isinstance(res, (may_v1.BaseModel, BaseModel)):
read_with_orm_mode = getattr(_get_model_config(res), "read_with_orm_mode", None)
if read_with_orm_mode:
# Let from_orm extract the data from this model instead of converting

Loading…
Cancel
Save