[ 
https://issues.apache.org/jira/browse/MESOS-4294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gilbert Song updated MESOS-4294:
--------------------------------
    Description: 
(This bug was exposed by MESOS-4184, when serializing docker v1 image manifest 
as protobuf).

Currently protobuf::parse returns failures when parsing any JSON containing 
JSON::Null. For example, assuming we have a protobuf message:
{noformat}
message Nested {
  optional string str = 1;
  repeated string json_null = 2;
}
{noformat}

If there exists any field containing JSON::Null, like below:
{noformat}
      {
        \"str\": \"message\",
        \"json_null\": null
      }
{noformat}
When we do protobuf::parse, it would return the following failure:
{noformat}
Failure parse: Not expecting a JSON null
{noformat}

  was:
(This bug was exposed by MESOS-4184, when serializing docker v1 image manifest 
as protobuf).

Currently protobuf::parse returns failures when parsing any JSON containing 
JSON::Null. Specifically, failures occur with two cases. For example, assuming 
we have a protobuf message:
{noformat}
message Foo {
  required string burger = 1;
  optional string cheese = 2;

  message Soda {
    optional string water = 1;
    repeated string ice = 2;
  }

  optional Soda soda = 3;
}
{noformat}

1. Neighbor non-required field contains JSON::Null.
{noformat}
      {
        \"burger\": \"big\",
        \"cheese\": null
      }
{noformat}
When we do protobuf::parse, it would return the following failure:
{noformat}
Failure parse: Not expecting a JSON null
{noformat}

2. Nested repeat field contains JSON::Null.
{noformat}
      {
        \"burger\": \"big\",
        \"soda\": {
            \"water\": \"mineral\",
            \"ice\": null
        }
      }
{noformat}
When we do protobuf::parse, it cannot capture the other non-repeat field.
{noformat}
Failure Value of: parse.get().soda().water()
     Actual: ""
Expected: "mineral"
{noformat}


> Protobuf parse should support parsing JSON object containing JSON Null.
> -----------------------------------------------------------------------
>
>                 Key: MESOS-4294
>                 URL: https://issues.apache.org/jira/browse/MESOS-4294
>             Project: Mesos
>          Issue Type: Bug
>          Components: stout
>            Reporter: Gilbert Song
>            Assignee: Gilbert Song
>              Labels: mesosphere
>
> (This bug was exposed by MESOS-4184, when serializing docker v1 image 
> manifest as protobuf).
> Currently protobuf::parse returns failures when parsing any JSON containing 
> JSON::Null. For example, assuming we have a protobuf message:
> {noformat}
> message Nested {
>   optional string str = 1;
>   repeated string json_null = 2;
> }
> {noformat}
> If there exists any field containing JSON::Null, like below:
> {noformat}
>       {
>         \"str\": \"message\",
>         \"json_null\": null
>       }
> {noformat}
> When we do protobuf::parse, it would return the following failure:
> {noformat}
> Failure parse: Not expecting a JSON null
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to