Skip to main content

ValidationIssueSummary

Struct ValidationIssueSummary 

Source
pub struct ValidationIssueSummary {
Show 15 fields pub severity: &'static str, pub message: String, pub rule_id: Option<String>, pub error_code: Option<String>, pub segment_tag: Option<String>, pub segment_occurrence: Option<u16>, pub segment_group: Option<String>, pub element_index: Option<u8>, pub component_index: Option<u8>, pub message_ref: Option<String>, pub suggestion: Option<String>, pub offset: Option<usize>, pub byte_end: Option<usize>, pub pruefidentifikator: Option<u32>, pub rule_origin: Option<&'static str>,
}
Expand description

The mako-facing projection of a single edifact_rs::ValidationIssue.

ValidationIssue is already owned and serializable; this type exists to shape the mako serialization contract — camelCase field names, a curated field set, severity as a stable string, and two derived fields the raw issue does not carry (rule_origin and the resolved pruefidentifikator).

Unconditionally available (no feature gate required). The serde feature adds #[derive(Serialize)] so instances can be JSON-encoded directly.

Fields§

§severity: &'static str

Severity string: "critical", "error", "warning", or "info".

§message: String

Human-readable description of the issue.

§rule_id: Option<String>

Stable rule identifier (e.g. "MIG-DTM-001" or "AHB-13001-STS-I0"), if available.

§error_code: Option<String>

Stable error code assigned by the validator, if any.

§segment_tag: Option<String>

Tag of the EDIFACT segment where the issue occurred, e.g. "DTM".

§segment_occurrence: Option<u16>

0-based index of the occurrence among all segments with segment_tag.

§segment_group: Option<String>

Segment group name in which the issue occurred (e.g. "SG4"), if available.

Populated from edifact_rs::ValidationIssue::segment_group.

§element_index: Option<u8>

0-based data-element index within the segment.

§component_index: Option<u8>

0-based component index within a composite data element.

§message_ref: Option<String>

UNH message reference (DE 0062) the issue belongs to.

§suggestion: Option<String>

Suggested remediation text, if available.

§offset: Option<usize>

Byte offset of the first byte of the affected region in the source input.

The start of edifact_rs::ValidationIssue::span.

§byte_end: Option<usize>

Exclusive byte offset of the end of the affected region in the source input.

Together with offset this forms a half-open byte range [offset, byte_end) that maps directly to an LSP Range or a miette source span. None when the issue has no span.

§pruefidentifikator: Option<u32>

The BDEW Prüfidentifikator (process variant code) associated with this issue, when the report was produced by a PID-specific validation layer.

This field enables downstream audit logs and monitoring systems to identify which BDEW process variant triggered a violation without re-reading the raw EDIFACT message — satisfying the regulatory traceability requirement for German energy market participants.

None when the validation layer does not use PID-gated rule packs (e.g. structural Layer 1–2 checks that apply to all process variants).

§rule_origin: Option<&'static str>

Validation layer that generated this issue.

Classifies the issue by its origin in the layered validation stack:

ValueLayerMeaning
"parse"L1EDIFACT parse / tokenizer error
"directory"L2Directory check (segment definitions, code lists)
"mig"L3MIG structural rule (segment ordering, cardinality)
"ahb"L4–L5AHB Bedingungsoperator rule
"custom"L6Caller-supplied CustomRulePack rule

Used by monitoring dashboards and regulatory audit systems to distinguish sender-side malformed EDI (L1–L2) from conformance violations (L3–L5) from local business-rule failures (L6).

Derived from the rule_id prefix heuristic:

  • "MIG-" prefix → "mig", "AHB-""ahb", "PARSE-""parse", "DIR-""directory", "CUSTOM-""custom".
  • None when the rule_id is absent or does not match a known prefix.

Implementations§

Source§

impl ValidationIssueSummary

Source

pub fn from_issue_with_pid( issue: &ValidationIssue, pruefidentifikator: Option<u32>, ) -> Self

Convert a ValidationIssue to a ValidationIssueSummary, tagging it with the Prüfidentifikator that was active during validation.

The PID is resolved in priority order:

  1. issue.context_get("pid") — set per-issue by AHB rule closures via with_context_entry("pid", …).
  2. pruefidentifikator — report-level fallback for callers that set the PID on the report rather than on individual issues.

Use this from EdiEnergyReport::serialize so every serialized issue carries the PID context needed for regulatory audit logs.

Trait Implementations§

Source§

impl Clone for ValidationIssueSummary

Source§

fn clone(&self) -> ValidationIssueSummary

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationIssueSummary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ValidationIssueSummary

Source§

fn eq(&self, other: &ValidationIssueSummary) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ValidationIssueSummary

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, O> Matches<O> for T
where T: PartialEq<O>,

Source§

fn validate_matches(&self, other: &O) -> bool

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.