Add the EDI purchase order processing sample - #161
Draft
niveathika wants to merge 2 commits into
Draft
Conversation
Reads an inbound EDIFACT interchange, identifies the trading partner from the envelope without a schema, then parses the orders with the generated library. A message the schema cannot read is quarantined with its parse error and the rest of the interchange is still processed. The schema comes from the free UN/EDIFACT D03A directory, adjusted for a partner that always sends a line-item quantity the standard leaves optional.
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Explain that the sample generates a library because the schema is adjusted for this partner, and that an unmodified standard ORDERS message can use ballerinax/edifact.d03a.supplychain directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
The finished code for a new how-to guide, Process Inbound EDI Purchase Orders from Trading Partners, which documents the envelope-aware
ballerina/ediAPI (ballerina-spec#1441). The docs PR follows inwso2/docs-integratorand links here.There is no EDI sample in this repository today.
The sample
integrator-default-profile/samples/edi-purchase-order-processing— a workspace with the integration and the generated EDI library:edi:edifactHeadersFromEdiFilereads theUNBenvelope — only the first 512 characters of the file — and the integration stops there if the sender is not the expected partner.interchangeFromEdiStringreads the whole envelope hierarchy. Envelope segments are fail-fast; transaction bodies are fail-safe, so the message that cannot be read is quarantined with its parse error while the other two orders are processed.The bundled
orders.ediholds two valid orders and a third message missing its mandatoryBGMsegment, so both paths are exercised on every run.Verified with
bal run:Notes
schema/ORDERS.jsonwas generated from the free UN/EDIFACT D03A directory and then adjusted for the partner: the line-itemQTYsegment, optional in the standard, is required here because this partner always sends it. That edit is the point of shipping the schema alongside the generated library — it is the record of what the partner actually sends, andREADME.mddocuments how to regenerate both.