From reviews-return-66179-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Thu Sep 21 01:58:31 2017 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6C084109AB for ; Thu, 21 Sep 2017 01:58:31 +0000 (UTC) Received: (qmail 50132 invoked by uid 500); 21 Sep 2017 01:58:31 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 50098 invoked by uid 500); 21 Sep 2017 01:58:31 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 50084 invoked by uid 99); 21 Sep 2017 01:58:31 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Sep 2017 01:58:31 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 92EA318B1E7; Thu, 21 Sep 2017 01:58:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.451 X-Spam-Level: **** X-Spam-Status: No, score=4.451 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_REPLYTO_END_DIGIT=0.25, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, NML_ADSP_CUSTOM_MED=1.2, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id PO9HQH92v7tw; Thu, 21 Sep 2017 01:58:29 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id E32095F5B6; Thu, 21 Sep 2017 01:58:28 +0000 (UTC) Received: from reviews.apache.org (unknown [10.41.0.12]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 40F76E00A3; Thu, 21 Sep 2017 01:58:28 +0000 (UTC) Received: from reviews-vm2.apache.org (localhost [IPv6:::1]) by reviews.apache.org (ASF Mail Server at reviews-vm2.apache.org) with ESMTP id 31046C404AB; Thu, 21 Sep 2017 01:58:28 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============0495939720442525451==" MIME-Version: 1.0 Subject: Re: Review Request 61109: Used the default value when parsing an optional enum field from JSON. From: Qian Zhang To: Benjamin Mahler , James Peach Cc: Mesos Reviewbot Windows , Qian Zhang , mesos Date: Thu, 21 Sep 2017 01:58:28 -0000 Message-ID: <20170921015828.1946.96711@reviews-vm2.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Qian Zhang X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/61109/ X-Sender: Qian Zhang References: <20170725151726.9520.42988@reviews-vm2.apache.org> In-Reply-To: <20170725151726.9520.42988@reviews-vm2.apache.org> Reply-To: Qian Zhang X-ReviewRequest-Repository: mesos --===============0495939720442525451== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/61109/ ----------------------------------------------------------- (Updated Sept. 21, 2017, 9:58 a.m.) Review request for mesos, Benjamin Mahler and James Peach. Changes ------- Rebased and updated the commit message. Summary (updated) ----------------- Used the default value when parsing an optional enum field from JSON. Bugs: MESOS-7828 https://issues.apache.org/jira/browse/MESOS-7828 Repository: mesos Description (updated) ------- 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/2/ Changes: https://reviews.apache.org/r/61109/diff/1-2/ 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 --===============0495939720442525451==--