Omit input data from validation errors #120
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Additionally, ensure that these errors only produce string descriptions, allowing us to normalize error shapes. Further still, adopt HTTP response status code 422 for errors where input is parsable but in an invalid form.
(n.b., in addition to the previously discussed
python-jsonschema
error messages, this also addresses error dicts emitted by Pydantic, which also include input data.)I tried to keep this quite narrow, though given that validation errors appear to be the only source of non-string error descriptions, I took the adjacent opportunity to simplify the base error model at the same time.
Note that one of the example APs ("whattimeisit") returns errors in a completely different format from the classes we provide. As such, I did not address it here. Open to continuing to noodle on the validation error messaging if anyone has ideas for simple, obvious improvements.
I'm considering whether additional tests are warranted as this handling appears to be somewhat under-exercised.
Updating APs to use this release should allow validation errors to appear correctly in Flows event logs, as the error parsing performed by the Globus Python SDK will begin to recognize these error messages once
description
is a string.