pub struct EdifactValidator<E: ConditionEvaluator> { /* private fields */ }Expand description
Validates EDIFACT messages against AHB business rules.
The validator is a pure validation engine: it receives pre-parsed segments, an AHB workflow, and an external condition provider. Parsing and message-type detection are the caller’s responsibility.
The validator is generic over the ConditionEvaluator implementation,
which is typically generated from AHB XML schemas.
§Example
use automapper_validation::validator::EdifactValidator;
use automapper_validation::eval::NoOpExternalProvider;
let evaluator = UtilmdConditionEvaluatorFV2510::new();
let validator = EdifactValidator::new(evaluator);
let external = NoOpExternalProvider;
let report = validator.validate(
&segments,
&ahb_workflow,
&external,
ValidationLevel::Full,
);
if !report.is_valid() {
for error in report.errors() {
eprintln!("{error}");
}
}Implementations§
Source§impl<E: ConditionEvaluator> EdifactValidator<E>
impl<E: ConditionEvaluator> EdifactValidator<E>
Sourcepub fn validate(
&self,
segments: &[OwnedSegment],
workflow: &AhbWorkflow,
external: &dyn ExternalConditionProvider,
level: ValidationLevel,
) -> ValidationReport
pub fn validate( &self, segments: &[OwnedSegment], workflow: &AhbWorkflow, external: &dyn ExternalConditionProvider, level: ValidationLevel, ) -> ValidationReport
Validate with a group navigator for group-scoped condition queries.
Same as [validate] but passes a GroupNavigator to the
EvaluationContext, enabling conditions to query segments within
specific group instances (e.g., “in derselben SG8”).
Sourcepub fn validate_tree(
&self,
validated_tree: &ValidatedTree<'_>,
segments: &[OwnedSegment],
external: &dyn ExternalConditionProvider,
level: ValidationLevel,
navigator: Option<&dyn GroupNavigator>,
) -> ValidationReport
pub fn validate_tree( &self, validated_tree: &ValidatedTree<'_>, segments: &[OwnedSegment], external: &dyn ExternalConditionProvider, level: ValidationLevel, navigator: Option<&dyn GroupNavigator>, ) -> ValidationReport
Validate using a pre-built ValidatedTree where each node carries its resolved EDIFACT value.
This is the preferred validation path – conditions see ctx.resolved_value
set from the tree node, so format conditions like [931] “ZZZ=+00” check
the correct segment instance (e.g., DTM+92, not DTM+137).