Sorry for your time, I had a bug in my code and found it after I revisited it again. Its working just like you said Thanks
On Tuesday, June 5, 2012 12:56:03 AM UTC+2, Jason Hsueh wrote: > > 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 view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/b7O6wipq_EUJ. 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.
