mesos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Peach <jor...@gmail.com>
Subject Re: protbuf to json not compatible
Date Fri, 24 Mar 2017 02:58:21 GMT

> On Mar 23, 2017, at 1:54 AM, Olivier Sallou <olivier.sallou@irisa.fr> wrote:
> 
> Hi,
> 
> when transforming a protobug message to json with MessageToJson, the
> json is not compatible with the json format expected by Mesos master.

This is because you generated the protobuf bindings with proto3 compiler. AFAICT they made
an incompatible change to the JSON wire format. This bites you when using the jsonpb Go package,
for example. I ended up post-processing the generated Go code to correct the field names.

> 
> For example, for volumes it generates
> 
> 
> volumes: [
> 
>    {'hostPath': '....',
> 
>      'containerPath': '...',
> 
>     ...
> 
>   }
> 
> ]
> 
> 
> but HTTP API expects "source" and "container_path"
> 
> is it an expected behavior ? This prevents from "creating" a task in
> protobuf format and sending it to HTTP API with a protobug to json
> conversion.

It’s expected from a proto3 compiler. IMHO this is a breaking change and they should have
made a fallback option, but there’s not one. There’s no good choices here AFAICT.

J
Mime
View raw message