File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
stac_fastapi/api/stac_fastapi/api Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change 1616## Changed
1717
1818* use ` stac_pydantic.version.STAC_VERSION ` instead of ` stac_pydantic.api.version.STAC_API_VERSION ` as application ` stac_version `
19+ * Return more informations from pydantic validation errors
1920
2021## [ 3.0.3] - 2024-10-09
2122
Original file line number Diff line number Diff line change 44from typing import Callable , Dict , Type , TypedDict
55
66from fastapi import FastAPI
7+ from fastapi .encoders import jsonable_encoder
78from fastapi .exceptions import RequestValidationError , ResponseValidationError
89from starlette import status
910from starlette .requests import Request
@@ -88,7 +89,7 @@ def request_validation_exception_handler(
8889 request : Request , exc : RequestValidationError
8990 ) -> JSONResponse :
9091 return JSONResponse (
91- content = ErrorResponse ( code = exc .__class__ . __name__ , description = str ( exc ) ),
92+ content = jsonable_encoder ({ "detail" : exc .errors (), "body" : exc . body } ),
9293 status_code = status .HTTP_400_BAD_REQUEST ,
9394 )
9495
You can’t perform that action at this time.
0 commit comments