On Mon, Mar 14, 2016 at 7:40 PM, Josh Haberman <haber...@google.com> wrote:
> On Mon, Mar 14, 2016 at 7:07 PM, Feng Xiao <xiaof...@google.com> wrote:
>> On Mon, Mar 14, 2016 at 6:14 PM, Tim Kientzle <kient...@gmail.com> wrote:
>>> I was considering Any for cases such as logging, data storage, and other
>>> systems where intermediaries do not need to access or understand the
>>> additional data. This was a common use of extensions in proto2:
>>> Intermediate handlers would decode and act on a limited set of well-known
>>> fields; additional data would be simply carried through until a final
>>> consumer decoded and acted on it. Any satisfies this use case for
>>> protobuf-only systems but not for systems that use JSON.
>> If you only use protobuf format, Any is mostly the same as extensions. If
>> you are using JSON, proto2 extension doesn't help solve the issue at all. I
>> think the problem is not that Any does not allow intermediate proxies to
>> pass through the data without knowing the type info, but that you are
>> trying to mix JSON and protobuf format in the same system. In google, we
>> are using a front-end proxy to convert JSON to/from protobuf, and
>> everything else behind it is using protobuf only. The current Any design
>> works with this approach very well. Not sure whether this works for your
>> case, but it's something worth considering.
> If I'm understanding Tim correctly, I think what he is saying is true even
> of systems that use only JSON. For example, consider an app in Ruby that
> msg = MyMessageType.decode_json(json_text)
> If the JSON contains an Any, this line of code requires the parser to
> fetch type info, and it must fail if it cannot be retrieved. This affects
> even JSON-only apps.
Yes, a JSON parser is required to know all the type info for parsing. For
client apps that consume JSON, I think it's reasonable to expect them to
have the type info?
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 post to this group, send email to email@example.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.