Gilbert Song created MESOS-4294:
-----------------------------------

             Summary: Protobuf parse should support 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


(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}



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

Reply via email to