Skip to content
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

[Issue 645] Restructure error response format #686

Merged
merged 11 commits into from
Nov 27, 2023
Merged

Conversation

chouinar
Copy link
Collaborator

@chouinar chouinar commented Nov 9, 2023

Summary

Fixes #645

Time to review: 20 mins

Changes proposed

Validation errors from Marshmallow are now formatted into the errors list on the response object.

Context for reviewers

I know this is a lot, it is a bit difficult to split up, and I'm happy to walk you through it.

There are a few high-level fundamental changes:

  1. Each of the Marshmallow schema + fields + validators needed to be restructured a little to allow for validation error type + a message.
  2. An error processor was attached to the application to restructure the Marshmallow errors
  3. All error scenarios should go through the error processor and be re-formatted if necessary (mainly just Marshmallow at the moment).

Additional information

A lot of tests focused on testing these changes, including a few test-only endpoints that validate various error

The endpoints still work properly locally, and more-or-less are unmodified outside of a few small edge cases that the new field classes now account for (nullability).

@chouinar chouinar requested review from acouch and daphnegold November 9, 2023 20:54
api/openapi.generated.yml Outdated Show resolved Hide resolved
@chouinar chouinar merged commit 26b3947 into main Nov 27, 2023
7 checks passed
@chouinar chouinar deleted the chouinar/error-handling branch November 27, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: API Error Handling
3 participants