Messages don't contain any schema identification - they're just the data.

I suggest you create a new message containing a single field which is a 
"oneof" containing the other types. You can then create that "container" 
message and serialize it, always deserialize to that container message, and 
then identify which case was used.

Jon

On Thursday, 3 August 2017 14:33:55 UTC+1, Itay Pupko wrote:
>
> I'm new to protobuf, and I'm trying to convert JSON object into protobuf 
> messages in c#.
> My question is, my .proto file contain several messages types. is there a 
> way to find the messages type dynamically or my only shot is by trying all 
> possible options?
>
> I mean, if I know this is a Version message, then I simply write:
>  ver = encoder.Parse<Version>(data);
>
> but if it can be one of two options, like 'Version' and 'SysParams'
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to