django-partial-index icon indicating copy to clipboard operation
django-partial-index copied to clipboard

Improve validation errors in mixin

Open sjamaan opened this issue 5 years ago • 1 comments

This has several improvements to how validation errors are raised by the mixin:

  • Use the Django built-in validation error generation to produce better errors:
    • The name of the field that triggered the validation error is used as the error dictionary key if it's a single field. This helps to highlight the field in a frontend.
    • For JSON-based APIs the code field is very useful to determine what is wrong with that particular field, and we rely on this in our project at work
  • When there are failing "standard" uniqueness checks, do not bail out early but merge partial unique validation errors into the standard errors.
  • When there are multiple partially unique indexes that trigger a uniqueness error, all errors are returned instead of just the first.

This builds on #15 so please take a look at that one first.

sjamaan avatar Mar 21 '19 11:03 sjamaan