Skip to content
Discussion options

You must be logged in to vote

EDIFlow provides 3-phase validation out of the box:

npm install @ediflow/edifact @ediflow/edifact-d96a
import { EdifactValidationServiceBuilder } from '@ediflow/edifact';

const validator = EdifactValidationServiceBuilder.forEDIFACT();
const result = validator.validate(parsedMessage);

if (result.isValid) {
  console.log('✅ Message is valid!');
} else {
  for (const error of result.errors) {
    console.error(`❌ ${error.code}: ${error.message}`);
    // e.g. "STRUCT_001: Mandatory segment BGM missing at position 2"
  }
}

The validation runs three phases:

  1. Syntax — delimiter consistency, segment termination
  2. Structure — segment order, mandatory/conditional rules per message type
  3. Business — …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hello-ediflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant