-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Use Bad Request status for InputCoercionException #18161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ Gradle check result for afa975d: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #18161 +/- ##
============================================
+ Coverage 72.54% 72.57% +0.03%
- Complexity 67234 67275 +41
============================================
Files 5476 5476
Lines 310444 310449 +5
Branches 45120 45122 +2
============================================
+ Hits 225211 225320 +109
- Misses 66834 66840 +6
+ Partials 18399 18289 -110 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Could we add a rest spec test that tests the end-to-end behavior with invalid input? Similar to something like this: OpenSearch/rest-api-spec/src/main/resources/rest-api-spec/test/bulk/10_basic.yml Lines 42 to 43 in 8dbf800
|
Thanks @dbwiddis LGTM, once we have the rest test we can get this PR in. |
❌ Gradle check result for 4c0edc8: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for 54e2c95: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for 54e2c95: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for 54e2c95: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Daniel Widdis <[email protected]>
❌ Gradle check result for 80801cf: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for 0719867: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Daniel Widdis <[email protected]>
❌ Gradle check result for 971cce6: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Failing on the Mixed cluster Yaml test because the old nodes don't have the fix... |
Signed-off-by: Daniel Widdis <[email protected]>
❌ Gradle check result for 39198e8: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
@prudhvigodithi @andrross ready for re-review. You may want to peek at #18194 as well. |
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.19 2.19
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.19
# Create a new branch
git switch --create backport/backport-18161-to-2.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 4ce638c06fe5a937bee30321f3c609927089de16
# Push it to GitHub
git push --set-upstream origin backport/backport-18161-to-2.19
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.19 Then, create a pull request where the |
Hi @dbwiddis you might need to manually backport 2.19. Thanks. |
…#18161) * Use Bad Request status for InputCoercionException Signed-off-by: Daniel Widdis <[email protected]> * Add yamlRestTest for the fix Signed-off-by: Daniel Widdis <[email protected]> * Skip test before 3.1.0 Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> (cherry picked from commit 4ce638c)
…8161) (#18203) * Use Bad Request status for InputCoercionException (#18161) * Use Bad Request status for InputCoercionException Signed-off-by: Daniel Widdis <[email protected]> * Add yamlRestTest for the fix Signed-off-by: Daniel Widdis <[email protected]> * Skip test before 3.1.0 Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> (cherry picked from commit 4ce638c) * Update CHANGELOG.md Co-authored-by: Owais Kazi <[email protected]> Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: Owais Kazi <[email protected]>
Description
The Jackson InputCoercionException is thrown for a "valid but incompatible input value"
As an exception caused by user input, a 400 (Bad Request) REST status is appropriate. Currently parsing XContent that encounters this error (such as an integer out of range) returns an inappropriate 500 status.
Related Issues
One of two problems reported in #18131
Check List
[ ] API changes companion pull request created, if applicable.[ ] Public documentation issue/PR created, if applicable.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.