View the full OpenApi example here:
EDI Data Element Identification
Each EDI simple data element is identified by its ID.
Use the x-edination-element-id OpenAPI extension to set the data element ID.
EDI Data Element Structure
The structure of each data element is usually depicted in their implementation guidelines with schemas more or less similar to the one below:
The image is copyrighted by X12.org
The schema defines the data type, EDI Code and minimum/maximum length. A description is also available for some or all data elements but it is not essential.
NOTE:
All values in the OpenAPI "format" atrribute and in the "enum" object are case sensitive and must be set exactly as prescribed by the implementation guide or set out below.
The following concepts must be used to convert the depicted structure above into OpenAPI Schema object:
-
Data Type (not EDI Code)
When the data type is not EDI Code (not marked as "ID" in the guideline), you can use the following values to set the data type in the OpenAPI "formats" attribute:
-
X12_AN - X12 alphanumeric
-
X12_NX - X12 numeric with implied decimal, X can be any between 0 and 7
-
X12_DT - X12 date
-
X12_TM - X12 time
-
X12_RX - X12 decimal, X is digits to the right of the decimal and can be any between 0 and 7
-
EDIFACT_AN - EDIFACT alphanumeric
-
EDIFACT_A - EDIFACT alphabetic
-
EDIFACT_N - EDIFACT numeric
-
-
Data Type (EDI Code)
EDI Codes are represented as OpenAPI "enum" objects of type string. Data elements with EDI Code type are represented as a property of type "string" with a Reference object to the underlying EDI Code type, wrapped up in OpenAPI "allOf":
-
Minimum/maximum length
Use OpenAPI "minLength" and "maxLength" attributes: