Expand description
The shape of a refused write: one Violation per broken rule, each with
the field it concerns, a stable code, the values the rule was checked
against, and a sentence a person can act on.
{ "success": false,
"error": "validation failed: field_not_writable: `status` …",
"violations": [
{ "path": "status", "code": "field_not_writable", "params": {}, "message": "…" } ] }The error string stays, so a client that reads only it keeps working; a
form reads violations to mark each field by its code. A violation the
database raises carries the same code as the application-side check, read
from the constraint’s name (see code_from_constraint).
Structs§
- Violation
- One broken rule.
Functions§
- code_
from_ constraint - The rule code a database constraint stands for.