-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61109/
-----------------------------------------------------------

(Updated Sept. 29, 2017, 8:24 a.m.)


Review request for mesos, Benjamin Mahler and James Peach.


Changes
-------

Leave the enum field unset if it is not a required field, after parsing, its 
accessor will return the default enum value.


Bugs: MESOS-7828
    https://issues.apache.org/jira/browse/MESOS-7828


Repository: mesos


Description
-------

Previously in MESOS-4997, we have made any inexistent enum value will
be parsed to the default enum value when parsing protobuf message from
a serialized string. Now in this patch, I made parsing protobuf message
from a JSON have the same behavior.


Diffs (updated)
-----

  3rdparty/stout/include/stout/protobuf.hpp 
15690b66cc4ae0c1bf2c2176d73c385ca75d3c20 


Diff: https://reviews.apache.org/r/61109/diff/3/

Changes: https://reviews.apache.org/r/61109/diff/2-3/


Testing
-------

With this patch, when accessing master endpoint with an inexistent enum `xxx` 
in a JSON:
```
curl -X POST -H "Content-Type: application/json" -d '{"type": "xxx"}' 
127.0.0.1:5050/api/v1
```
The master log will be:
```
I0725 23:09:53.097790   665 http.cpp:1133] HTTP POST for /master/api/v1 from 
127.0.0.1:49566 with User-Agent='curl/7.47.0'
I0725 23:09:53.098006   665 http.cpp:669] Processing call UNKNOWN
```
This proves when parsing an inexistent enum the default enum value (i.e., 
`UNKNOWN`) will be used.


Thanks,

Qian Zhang

Reply via email to