Re: [protobuf] Deserializng JSON tagged unions?

2016-05-10 Thread 'Feng Xiao' via Protocol Buffers
On Tue, May 10, 2016 at 7:31 AM, Marco Farrugia wrote: > Unnecessary being that deserialization ismore than a switch on the type. > The Union approach also puts all the fields on one object, as opposed to > separating by the type field - this is what I wanted to confirm as >

Re: [protobuf] Deserializng JSON tagged unions?

2016-05-10 Thread Marco Farrugia
Unnecessary being that deserialization ismore than a switch on the type. The Union approach also puts all the fields on one object, as opposed to separating by the type field - this is what I wanted to confirm as unsupported by protobuf. On Tue, May 10, 2016, 10:22 Tim Kientzle

Re: [protobuf] Deserializng JSON tagged unions?

2016-05-10 Thread Marco
That does work, but it seems like it creates a lot of unnecessary work if there are many fields. Is there a better way to handle a schema more like this? { type: "error", message: "wrong"} or { type:"ok", a: 1, b:2, c:3, d:4, ... }. On Monday, May 9, 2016 at 3:12:19 PM UTC-4, Feng Xiao

Re: [protobuf] Deserializng JSON tagged unions?

2016-05-09 Thread 'Feng Xiao' via Protocol Buffers
On Fri, May 6, 2016 at 8:18 PM, Marco wrote: > I'm looking to generate de/serialization for json tagged union messages > from an external rest api, eg. > { type: "error", message: "wrong"} or { type:"ok", response: { a: 1, b: > 2}}. > > Reading the docs it seems like an any

[protobuf] Deserializng JSON tagged unions?

2016-05-06 Thread Marco
I'm looking to generate de/serialization for json tagged union messages from an external rest api, eg. { type: "error", message: "wrong"} or { type:"ok", response: { a: 1, b: 2}}. Reading the docs it seems like an any valued field the type field modified json_name would work similarly,