Is it ok to have message like this?
message A {
required int64 some_number = 1;
// .... some more fields
optional A sub_a = 123;
}
The reason is my current protocol stores set of A directly, and wrapping A’s in another message will lead to massive conversions of stored data.
2.2.0 protoc compiles it ok.
Can this make any problems with serialization/deserialization, and is it supported by protobuf-net.
That is a perfectly fine definition, and should work in any implementation (including protobuf-net); are you seeing any problem? HOWEVER! you might want to consider the computational impact of serialization – in particular, to serialize a sub-message, the size of the sub-messages needs to be known first. A deeply recursive method (as necessitated by this linked-list) may cause some issues.
Is there any reason this can’t be just a
repeatedmessage instead? that would by far be my preference.