The handling of unknown fields is precisely where the difference lies and sticking to proto2 is indeed the plan. However, because you have many clients forced to stick with proto2, you inevitably bifurcate the users, and implementations are now forced to support two standards. Proto3 was designed supposedly to *simplify* the implementation of the protocol, but this is moot when the old implementation is necessary anyways. Honestly, it feels like a repeat of a python2 and python3 thingy (although admittedly perhaps not as serious).
As for JSON fields not being keyed to field number, that was a choice made with the encoding and has nothing to do with JSON itself. Do those JSON blobs also lose forward compatibility when the schema changes? Thanks for the discussion, J On Thu, May 19, 2016 at 7:01 PM, Tim Kientzle <[email protected]> wrote: > > > On May 18, 2016, at 10:01 PM, Jeremy Ong <[email protected]> wrote: > > > > Why does adding JSON require dropping unknown fields? So long as fields > are keyed to field number, I don't see why the JSON encoding requires > special treatment with respect to the binary one. > > JSON fields aren’t keyed to field number. They’re keyed to field name. > > Even apart from field naming, JSON and protobuf wire formats don’t > correspond 1:1, so you can’t even correctly translate the primitive values > without the schema. > > > However, proto3 makes breaks in compatibility with the underlying data > (proto2 encoded), which is where I find myself in disagreement. > > What do you think is different? Having decoded (by hand) a fair bit of > proto2 and proto3 data, they look exactly the same to me. > > As I mentioned before, if preserving unknown fields is essential for you, > you should stick with proto2. It’s still around and will be for a long > time. > Cheers, > > Tim > > -- Jeremy Ong PlexChat CTO 650.400.6453 -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
