mesos-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qian Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MESOS-8656) Improve stout JSON -> protobuf message conversion to handle more valid JSONs
Date Fri, 09 Mar 2018 08:33:00 GMT
Qian Zhang created MESOS-8656:
---------------------------------

             Summary: Improve stout JSON -> protobuf message conversion to handle more
valid JSONs
                 Key: MESOS-8656
                 URL: https://issues.apache.org/jira/browse/MESOS-8656
             Project: Mesos
          Issue Type: Improvement
            Reporter: Qian Zhang


The followings are valid in JSON which can be successfully parsed by Google's protobuf utility
function {{JsonStringToMessage()}} but can NOT be parsed our stout, i.e., call {{JSON::parse()}}
to convert the JSON to a stout JSON object and then call {{protobuf::parse()}} to parse the
JSON object to a protobuf message.
{code:java}
"int32": "-2147483647"
"int64": "-9223372036854775807"
"bool": "true"
{code}
The second step ({{protobuf::parse()}}) will fail with an error like this:
{code:java}
Not expecting a JSON string for field 'int32'
{code}
This error comes from {{Try<Nothing> operator()(const JSON::String& string)}} which
currently can only convert {{JSON::String}} to protobuf string/bytes/enum, so we need to enhance
it to be able to convert {{JSON::String}} to bools and integers.

What we can parse currently are:
{code:java}
"int32": -2147483647
"int64": -9223372036854775807
"bool": true{code}
We should make the behavior of our stout JSON -> protobuf conversion consistent with Google's.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message