Open knoguchi opened 7 years ago
This may be because in absence of specification of the root type (and since protobuf format has no concept of root type id, as far as I know), the first message type is assumed to be the root.
Now... it is possible to specify one of the other message types to be the root to use, with:
ProtobufSchema schema = schema.withRootType("Main")
This may not be the most obvious API design, but since I don't know of other ways to specify which of multiple message types user wants, there has to be something to design it.
One alternative would also to throw an exception if schema has multiple possible message types, and user does not explicitly specify one to use.
ObjectWriter fails to serialize depends on the order of messages defined in a proto file.
proto1 below works fine.
proto2 below fails. The only difference is the order of message types.
Stack trace
Here is the test case.