amazon-ion / ion-schema-rust

Rust implementation of Ion Schema
https://amazon-ion.github.io/ion-schema/sandbox
Apache License 2.0
13 stars 6 forks source link

implemnattion of `Display` for `Violation` #105

Closed desaikd closed 2 weeks ago

desaikd commented 2 years ago

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 
}