You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Jie Yu <yu...@gmail.com> on 2016/12/18 18:59:55 UTC

Map support in proto2

Looks like Map is already supported in proto2:
https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#map-fields

It'll greatly simply our json parsing in a few cases (e.g., converting from
OCI image configuration to a protobuf definition for key->value json
object):

"annotations" : {
  "key1" : "value1",
  "key2" : "value2"
}

Previously, it's not possible to have a protobuf scheme for such a json.

Thoughts?

- Jie

Re: Map support in proto2

Posted by tommy xiao <xi...@gmail.com>.
+1 for upgrading proto2

2016-12-19 7:03 GMT+08:00 Neil Conway <ne...@gmail.com>:

> I believe `oneof` is supported in protobuf 2.6.1 [1], so we wouldn't
> need to upgrade to make use of it. But I agree that upgrading to
> protobuf 3 (while continuing to use the proto2 language version) is
> worth doing at some point.
>
> Neil
>
> [1] https://groups.google.com/forum/#!topic/protobuf/lvI8-
> sWZbUY/discussion
>
> On Sun, Dec 18, 2016 at 4:31 PM, Michael Park <mp...@apache.org> wrote:
> > According to this thread
> > https://groups.google.com/forum/m/#!topic/protobuf/p4WxcplrlA4,
> >
> > It would involve us upgrading proto to 3.0.0 (which does not mean
> proto3).
> > It seems like we would also get `oneof` which would also be very useful
> for
> > us.
> >
> > On Sun, Dec 18, 2016 at 11:00 AM Jie Yu <yu...@gmail.com> wrote:
> >
> >> Looks like Map is already supported in proto2:
> >>
> >>
> >> https://developers.google.com/protocol-buffers/docs/
> reference/cpp-generated#map-fields
> >>
> >>
> >>
> >> It'll greatly simply our json parsing in a few cases (e.g., converting
> from
> >>
> >> OCI image configuration to a protobuf definition for key->value json
> >>
> >> object):
> >>
> >>
> >>
> >> "annotations" : {
> >>
> >>   "key1" : "value1",
> >>
> >>   "key2" : "value2"
> >>
> >> }
> >>
> >>
> >>
> >> Previously, it's not possible to have a protobuf scheme for such a json.
> >>
> >>
> >>
> >> Thoughts?
> >>
> >>
> >>
> >> - Jie
> >>
> >>
>



-- 
Deshi Xiao
Twitter: xds2000
E-mail: xiaods(AT)gmail.com

Re: Map support in proto2

Posted by Neil Conway <ne...@gmail.com>.
I believe `oneof` is supported in protobuf 2.6.1 [1], so we wouldn't
need to upgrade to make use of it. But I agree that upgrading to
protobuf 3 (while continuing to use the proto2 language version) is
worth doing at some point.

Neil

[1] https://groups.google.com/forum/#!topic/protobuf/lvI8-sWZbUY/discussion

On Sun, Dec 18, 2016 at 4:31 PM, Michael Park <mp...@apache.org> wrote:
> According to this thread
> https://groups.google.com/forum/m/#!topic/protobuf/p4WxcplrlA4,
>
> It would involve us upgrading proto to 3.0.0 (which does not mean proto3).
> It seems like we would also get `oneof` which would also be very useful for
> us.
>
> On Sun, Dec 18, 2016 at 11:00 AM Jie Yu <yu...@gmail.com> wrote:
>
>> Looks like Map is already supported in proto2:
>>
>>
>> https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#map-fields
>>
>>
>>
>> It'll greatly simply our json parsing in a few cases (e.g., converting from
>>
>> OCI image configuration to a protobuf definition for key->value json
>>
>> object):
>>
>>
>>
>> "annotations" : {
>>
>>   "key1" : "value1",
>>
>>   "key2" : "value2"
>>
>> }
>>
>>
>>
>> Previously, it's not possible to have a protobuf scheme for such a json.
>>
>>
>>
>> Thoughts?
>>
>>
>>
>> - Jie
>>
>>

Re: Map support in proto2

Posted by Michael Park <mp...@apache.org>.
According to this thread
https://groups.google.com/forum/m/#!topic/protobuf/p4WxcplrlA4,

It would involve us upgrading proto to 3.0.0 (which does not mean proto3).
It seems like we would also get `oneof` which would also be very useful for
us.

On Sun, Dec 18, 2016 at 11:00 AM Jie Yu <yu...@gmail.com> wrote:

> Looks like Map is already supported in proto2:
>
>
> https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#map-fields
>
>
>
> It'll greatly simply our json parsing in a few cases (e.g., converting from
>
> OCI image configuration to a protobuf definition for key->value json
>
> object):
>
>
>
> "annotations" : {
>
>   "key1" : "value1",
>
>   "key2" : "value2"
>
> }
>
>
>
> Previously, it's not possible to have a protobuf scheme for such a json.
>
>
>
> Thoughts?
>
>
>
> - Jie
>
>