Implement a Display for Violation which could represent all the violations in a nested struct form.
(Adding the type name for which the violation occurred should help direct to the root cause)
e.g.
Schema:
type::{
name: my_int,
type: int,
}
Input(value to be validated):
[1, 2]
{
message: "value didn't satisfy type constraint(s)",
constraint: my_int,
violations: [
{
message: "expected type Integer, found List",
constraint: type_constraint,
violations: [ ],
code: type_mismatched
}
],
code: type_constraints_unsatisfied
}
Implement a
Display
forViolation
which could represent all the violations in a nested struct form. (Adding the type name for which the violation occurred should help direct to the root cause)e.g.