From adfcc1c8a6f6cf8552b5a75fa22c5585fce29bbd Mon Sep 17 00:00:00 2001 From: johnslavik Date: Sun, 21 Dec 2025 16:15:19 +0100 Subject: [PATCH] Dump all types of models --- fastapi/routing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index 24fc77f81..1ca32a237 100644 --- a/fastapi/routing.py +++ b/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