swistakm/graceful

Better validation error representation.

swistakm opened this issue · 0 comments

There are few major issues with current validation error representation.

  1. Validation on bulk resource creation will not tell which object in whole batch did not pass validation.
  2. Validation of fields with many=True quits on first invalid value and does not allow to find out if all values were incorrect or only few of them. Also if not all, we don't know which ones.
  3. ValueError exceptions are treated equally with ValidationError exceptions. This is great because allows for easier integration with built-in or custom types but on the other hand can leak some implementation details to the user agent. It is equally bad as presenting stack trace to user agent. We should treat ValidationError exceptions as explicit errors that can be safely presented to the user, but ValueError exceptions should be replaced with generic and safe information in type of "Could not parse" or "Invalid format".