The preservation of order should be possible. This behavior can be observed in Django's models.
The new format should change from this:
class DefaultValuePacket(SerdepaPacket):
_fields_ = [
("header", nx_uint8, 1),
("version", nx_uint8),
("timestamp", nx_uint32, 12345),
("length", Length(nx_uint8, "data")),
("data", List(nx_uint8), [1, 2, 3, 4]),
("tail", List(nx_uint8), [5, 6])
]
to this:
class DefaultValuePacket(SerdepaPacket):
header = nx_uint8(1)
version = nx_uint8
timestamp = nx_uint32(12345)
length = Length(nx_uint8, "data")
data = List(nx_uint8, [1, 2, 3, 4]),
tail = List(nx_uint8, [5, 6])