Required-field checking is only recursively applied when a message is present. If your top-level Message only contains NestedMessage, the initialization code should not be checking the AnotherNestedMessage field to make sure that that submessage has all required fields populated. Can you provide a reproduction demonstrating the exception?
On Sat, Jun 2, 2012 at 11:56 PM, Tomas Kislan <[email protected]> wrote: > Hello, > i have little problem with "dynamic" messages > as i want to send with required message_type, and according to that > type i want to send different nested message along it > > example: > > message Message { > required int64 type = 1; > > optional NestedMessage = 20; > optional AnotherNestedMessage = 21; > } > > now those nested messages have some required fields, but themselves > are optional in message > > so lets say if type == 1 i want to send NestedMessage, if type == 2 > AnotherNestedMessage > but if i dont fill both messages, i get protobuf fatalexception that > the fields from the nested message, i dont want to use atm, are > missing > > and thats kinda unwanted behaviour for me and i ask: > is there a possible solution how to overcome this? > or another way how to do different types of nested messages? > Thank you > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
