Repository navigation
fix(api): return 422 for missing QueryParams fields - #7630
axelray-dev wants to merge 3 commits into
Conversation
anujbolewar
left a comment
There was a problem hiding this comment.
Sensibly dropping the all_in_query condition since every QueryParams validation should indeed surface as a query-param error. The one case to double check: a QueryParams-backed model can also be used to bind a request body in some routes, and for those the detail will now wrongly claim it sits in query params — confirm the involved routes all read from the query string, otherwise keep a guard that checks whether the request carried a body.
|
Addressed the body-binding edge case from your review. The handler now rewrites a Added a regression test for a
Please re-review the updated thread. |
|
Verified the current head includes the body-binding guard requested in review: QueryParams errors are rewritten to query-scoped 422 details only when the request body is empty; body-bound validation follows the normal 500 path. VPS validation: 4 passed for openbb_platform/core/tests/api/test_exception_handlers.py. No additional code change was needed. |
|
I verified the concern against the current branch. The handler now keeps QueryParams relabeling only for requests with no body, and the regression suite covers both a missing query field and a QueryParams-shaped validation error from a body-bound request. On the VPS, openbb_platform/core/tests/api/test_exception_handlers.py passes: 4 passed. I did not find a further code change required for the reviewer’s stated case. |
|
Confirmed the review concern is handled in the current head: the QueryParams relabeling is now guarded by |
18dcfe6 to
6bf62b5
Compare
ea8c247 to
e07c28b
Compare
Summary
Missing required fields on a
QueryParamsmodel now return HTTP 422 with query-scoped error locations. Response validation remains 422, while non-query validation errors keep the existing 500 fallback.Fixes #7629.
Tests
uv run --project openbb_platform/core --no-dev --with pytest --with pytest-asyncio pytest -q openbb_platform/core/tests/api/test_exception_handlers.py(14 passed)