Add `marshal_strict` feature
Hello! We in gowaves use this plug-in to marshal messages for producing signatures futher and compare them to signed messages which would be marshalled by other languages implementations. The problem is that many other implementations of protobuf (for e.g. Java) marshal fields in the strict order by their numbers declared in .proto file. Consequently, the most rational way to use such marshal scheme in all languages we use in our project.
marshal feature doesn't satisfy this requirement and mustn't do as it should behave indentically to proto.Marshal() which doesn't satisfy respectively. To be more precise the difference is that oneOfs fields are marshalled before others(#22) and in the example below ethereum_transaction would be marshalled before proofs:
message SignedTransaction {
oneof transaction {
Transaction waves_transaction = 1;
bytes ethereum_transaction = 3;
}
repeated bytes proofs = 2;
}
But we would like ethereum_transaction to be marshalled after proofs.
We came with implementation of the new feature marshal_strict that solves this problem and can be useful in similar cases.