FIXTradingCommunity / fix-orchestra

Machine readable rules of engagement
Apache License 2.0
71 stars 34 forks source link

[repository schema] Byte ordering of mapped data type #214

Open mkudukin opened 1 month ago

mkudukin commented 1 month ago

The proposal is to add ability to define the byte order (endianness) as discussed in https://github.com/FIXTradingCommunity/fix-orchestra/discussions/197.

Issue

Binary protocols may choose either big-endian or little-endian byte order for specific reasons. It's important for message protocols to clearly state its byte order in an Orchestra file. In FIX SBE, for instance, the byte order is globally specified in a message schema.

Proposal

Since datatypes are closely related to the encoding protocol, we recommend adding optional byteOrder attribute to the mappedDatatype element. Valid values should be bigEndian and littleEndian. The absence of the attribute would mean byte order is unspecified (e.g. for character types).

Example

<datatypes>
    <datatype name="int16">
        <mappedDatatype standard="ISO11404" base="integer" byteOrder="bigEndian" ... />
    </datatype>
    <datatype name="price">
        <mappedDatatype standard="ISO11404" base="scaled" byteOrder="bigEndian" ... />
    </datatype>
    ...
</datatypes>