How to validate EDIFACT messages in TypeScript? (syntax, structure, mandatory segments) #67
Answered
by
hello-ediflow
hello-ediflow
asked this question in
Q&A
-
|
I'm building an EDI gateway and need to validate incoming EDIFACT messages before processing. I need:
|
Beta Was this translation helpful? Give feedback.
Answered by
hello-ediflow
May 7, 2026
Replies: 1 comment
-
|
EDIFlow provides 3-phase validation out of the box: npm install @ediflow/edifact @ediflow/edifact-d96aimport { 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:
Works with all supported standards (EDIFACT D.96A–D.20B, EANCOM, X12). |
Beta Was this translation helpful? Give feedback.
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
EDIFlow provides 3-phase validation out of the box:
The validation runs three phases: