pub struct Bo4eFieldIndex { /* private fields */ }Expand description
Maps EDIFACT segment paths from validation errors to BO4E field paths.
Implementations§
Source§impl Bo4eFieldIndex
impl Bo4eFieldIndex
Sourcepub fn build(definitions: &[MappingDefinition], mig: &MigSchema) -> Self
pub fn build(definitions: &[MappingDefinition], mig: &MigSchema) -> Self
Build the index from TOML mapping definitions and a MIG schema.
For each field in each definition, resolves the TOML numeric path
(e.g., loc.1.0) to an AHB-style EDIFACT path (e.g., SG4/SG5/LOC/C517/3225)
using the MIG schema for element ID lookup.
Sourcepub fn build_with_resolver(
definitions: &[MappingDefinition],
mig: &MigSchema,
resolver: &ReversePathResolver,
) -> Self
pub fn build_with_resolver( definitions: &[MappingDefinition], mig: &MigSchema, resolver: &ReversePathResolver, ) -> Self
Build the index using a ReversePathResolver for element ID lookup.
This is more accurate than build because the resolver is built from
unmerged PID schema JSONs, avoiding data loss from MIG group merging
(e.g., CCI composites lost when merging SG10 variants).
Sourcepub fn resolve(
&self,
edifact_field_path: &str,
hint: Option<&str>,
) -> Option<String>
pub fn resolve( &self, edifact_field_path: &str, hint: Option<&str>, ) -> Option<String>
Given an EDIFACT field_path from a ValidationIssue, return the BO4E path.
hint is an optional disambiguation string (e.g., expected value or AHB rule)
that helps pick the right entry when multiple TOML definitions map to the same
EDIFACT path (e.g., DTM+92 and DTM+93 both map to SG4/DTM/C507/2005).