Skip to content

fix(event_handler): hide error details by default #3406

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

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

rubenfonseca
Copy link
Contributor

@rubenfonseca rubenfonseca commented Nov 23, 2023

Issue number: #3405

Summary

Changes

Please provide a summary of what's being changed

This PR simplifies the default format for data validation errors, exposing just the location (field name) and the type of error.

User experience

Please share what the user experience looks like before and after this change

This code:

@app.get("/claims")
def claims() -> Dict[str, Any]:
    return "oh no, this is not a dict"  # type: ignore

Now returns the following payload:

{
	"statusCode": 422,
	"detail": [{"loc": ["response"], "type": "dict_type"}]
}

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 23, 2023
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (365c2dc) 95.41% compared to head (49fc5c7) 95.39%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3406      +/-   ##
===========================================
- Coverage    95.41%   95.39%   -0.03%     
===========================================
  Files          209      209              
  Lines         9647     9648       +1     
  Branches      1769      809     -960     
===========================================
- Hits          9205     9204       -1     
- Misses         329      330       +1     
- Partials       113      114       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rubenfonseca rubenfonseca marked this pull request as ready for review November 23, 2023 10:47
@rubenfonseca rubenfonseca requested a review from a team November 23, 2023 10:47
@rubenfonseca rubenfonseca linked an issue Nov 23, 2023 that may be closed by this pull request
@rubenfonseca rubenfonseca added this to the OpenAPI in Event Handler milestone Nov 23, 2023
@heitorlessa heitorlessa added feature New feature or functionality bug Something isn't working and removed feature New feature or functionality labels Nov 23, 2023
@heitorlessa heitorlessa changed the title fix(event_handler): simplify default data validation error format fix(event_handler): hide error details by default Nov 23, 2023
@heitorlessa heitorlessa merged commit 716ff9a into develop Nov 23, 2023
@heitorlessa heitorlessa deleted the rf/expose-less branch November 23, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working event_handlers size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: the validation failure response might expose too much data
3 participants