OpenAPI EDI Data Element

  View the full OpenApi example here:

EdiNation X12 837P OpenAPI example

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

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.


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:

  1. 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:

    1. X12_AN - X12 alphanumeric

    2. X12_NX - X12 numeric with implied decimal, X can be any between 0 and 7

    3. X12_DT - X12 date

    4. X12_TM - X12 time

    5. X12_RX - X12 decimal, X is digits to the right of the decimal and can be any between 0 and 7

    6. EDIFACT_AN - EDIFACT alphanumeric

    7. EDIFACT_A - EDIFACT alphabetic

    8. EDIFACT_N - EDIFACT numeric


  2. 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":

  3. Minimum/maximum length

    Use OpenAPI "minLength" and "maxLength" attributes: 


Was this article helpful?
0 out of 0 found this helpful