Note: There is a newer version (1.5.1) of this package available. Click here to view docs for the latest version.
ballerina/edi Ballerina library
1.4.0
Functions
fromEdiString
Isolated Function
Reads the given EDI text according to the provided schema.
Return Type
- json|Error - JSON variable containing EDI data. Error if the reading fails.
getDataType
function getDataType(string typeString) returns EdiDataTypeParameters
- typeString string -
getSchema
Isolated Function
Creates an EDI schema from a string or a JSON.
Parameters
- schema string|json - Schema of the EDI type
toEdiString
Isolated Function
Writes the given JSON varibale into a EDI text according to the provided schema.
Enums
edi: EdiDataType
Members
STRING
INT
FLOAT
COMPOSITE
Records
edi: EdiComponentSchema
Closed record
Fields
- tag string -
- required boolean(default false) -
- truncatable boolean(default true) -
- dataType EdiDataType(default STRING) -
- subcomponents EdiSubcomponentSchema[](default []) -
edi: EdiFieldSchema
Closed record
Fields
- tag string -
- repeat boolean(default false) -
- required boolean(default false) -
- truncatable boolean(default true) -
- dataType EdiDataType(default STRING) -
- startIndex int(default -1) -
- components EdiComponentSchema[](default []) -
edi: EdiSchema
Closed record
Record for representing EDI schema.
Fields
- name string - Name of the schema. This will be used as the main record name by the code generation tool.
- tag string(default "Root_mapping") - Tag for the root element. Can be same as the name.
- ignoreSegments string[](default []) - List of segment schemas to be ignored when matching a EDI text. For example, if it is necessary to process X12 transaction sets only, without ISA as GS segments, and if the schema contains ISA and GS segments as well, ISA and GS can be provided as ignoreSegments.
- preserveEmptyFields boolean(default true) - Indicates how to process EDI fields, components and subcomponents containing empty values. true: Includes fields, components and subcomponents with empty values in the generated JSON. String values will be represented as empty strings. Multi-value fields (i.e. repeats) will be represented as empty arrays. All other types will be represented as null. false: Omits fields, components and subcomponents with empty values.
- includeSegmentCode boolean(default true) - Indicates whether or not to include the segment code as a field in output JSON values.
- segments EdiUnitSchema[](default []) - Array of segment and segment group schemas
- segmentDefinitions map<EdiSegSchema>(default {}) - Map of segment definitions indexed by the segment code
edi: EdiSegGroupSchema
Closed record
Fields
- tag string -
- minOccurances int(default 0) -
- maxOccurances int(default 1) -
- segments EdiUnitSchema[](default []) -
edi: EdiSegSchema
Closed record
Fields
- code string -
- tag string -
- truncatable boolean(default true) -
- minOccurances int(default 0) -
- maxOccurances int(default 1) -
- fields EdiFieldSchema[](default []) -
edi: EdiSubcomponentSchema
Closed record
Fields
- tag string -
- required boolean(default false) -
- dataType EdiDataType(default STRING) -
edi: EdiUnitRef
Closed record
Fields
- ref string -
- tag? string -
- minOccurances int(default 0) -
- maxOccurances int(default 1) -
edi: Range
Closed record
Fields
- min int(default 0) -
- max int(default -1) -
Errors
edi: Error
Distinct
Represents EDI module related errors
Union types
edi: EdiUnitSchema
EdiUnitSchema
Import
import ballerina/edi;Metadata
Released date: 11 months ago
Version: 1.4.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.11.0-20241209-162400-0c015833
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 0
Weekly downloads
Keywords
edi
Contributors
Dependencies