| 275 | |
| 276 | impl std::fmt::Display for ValidationError { |
| 277 | fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 278 | match self { |
| 279 | ValidationError::Schema { |
| 280 | code, |
| 281 | ref message, |
| 282 | ref location, |
| 283 | } => { |
| 284 | let message = message.as_ref().map_or_else(|| "", |f| f); |
| 285 | write!( |
| 286 | fmt, |
| 287 | "Schema validation error: {{ code: {code} message: {message}, location: {location} }}" |
| 288 | ) |
| 289 | } |
| 290 | ValidationError::Field { |
| 291 | code, |
| 292 | message, |
| 293 | field, |
| 294 | params, |
| 295 | location, |
| 296 | } => { |
| 297 | let message = message.as_ref().map_or_else(|| "", |f| f); |
| 298 | write!( |
| 299 | fmt, |
| 300 | "Validation error: {{ code: {code} location: {location}, field: {}, message: {message}, params: {params:?} }}", field.unwrap() |
| 301 | ) |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | impl std::fmt::Display for ValidationErrors { |