Skip to main content

Module validate

Module validate 

Source
Expand description

Validation trait and types for ISO 20022 generated types.

The Validatable trait enables generated types to self-validate against their XSD constraints (pattern, length, range, etc.). Implementations are generated by the mx20022-codegen tool based on XSD restriction annotations.

Struct types recurse into their fields; newtypes check their inner value against known constraints; code enums and opaque types are no-ops.

§Example

use mx20022_model::common::validate::{Validatable, ConstraintViolation};

// Generated types implement Validatable:

let val = Max35Text("short".to_string());
let mut violations = Vec::new();
val.validate_constraints("/Path/Field", &mut violations);
assert!(violations.is_empty());

Structs§

ConstraintError
Error returned when constructing a constrained newtype with an invalid value.
ConstraintViolation
A violation of an XSD-level constraint.

Enums§

ConstraintKind
The kind of XSD constraint that was violated.

Traits§

IsoMessage
Marker trait for document-level types that represent a complete ISO 20022 message.
Validatable
Types that can self-validate against their XSD-level constraints.