[apps-discuss] merge-patch: more examples

"Manger, James H" <James.H.Manger@team.telstra.com> Tue, 21 May 2013 13:50 UTC

Return-Path: <James.H.Manger@team.telstra.com>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost []) by ietfa.amsl.com (Postfix) with ESMTP id 85CC821F93E8 for <apps-discuss@ietfa.amsl.com>; Tue, 21 May 2013 06:50:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.537
X-Spam-Status: No, score=0.537 tagged_above=-999 required=5 tests=[AWL=-0.421, BAYES_20=-0.74, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, RELAY_IS_203=0.994]
Received: from mail.ietf.org ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id fneXpuzo1Tnu for <apps-discuss@ietfa.amsl.com>; Tue, 21 May 2013 06:50:29 -0700 (PDT)
Received: from ipxcvo.tcif.telstra.com.au (ipxcvo.tcif.telstra.com.au []) by ietfa.amsl.com (Postfix) with ESMTP id 889B721F955C for <apps-discuss@ietf.org>; Tue, 21 May 2013 06:50:25 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="4.87,714,1363093200"; d="scan'208";a="136995960"
Received: from unknown (HELO ipcdvi.tcif.telstra.com.au) ([]) by ipocvi.tcif.telstra.com.au with ESMTP; 21 May 2013 23:50:24 +1000
X-IronPort-AV: E=McAfee;i="5400,1158,7081"; a="133220127"
Received: from wsmsg3757.srv.dir.telstra.com ([]) by ipcdvi.tcif.telstra.com.au with ESMTP; 21 May 2013 23:50:23 +1000
Received: from WSMSG3153V.srv.dir.telstra.com ([]) by wsmsg3757.srv.dir.telstra.com ([]) with mapi; Tue, 21 May 2013 23:50:23 +1000
From: "Manger, James H" <James.H.Manger@team.telstra.com>
To: IETF Apps Discuss <apps-discuss@ietf.org>, James M Snell <jasnell@gmail.com>
Date: Tue, 21 May 2013 23:50:20 +1000
Thread-Topic: merge-patch: more examples
Thread-Index: Ac5WKiKQ77gpB95DRUiTqnNuebnNxw==
Message-ID: <255B9BB34FB7D647A506DC292726F6E1151A6C8594@WSMSG3153V.srv.dir.telstra.com>
Accept-Language: en-US, en-AU
Content-Language: en-US
acceptlanguage: en-US, en-AU
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Subject: [apps-discuss] merge-patch: more examples
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 21 May 2013 13:50:35 -0000

The list of test cases in draft-ietf-appsawg-json-merge-patch is a great addition.

A couple more would be worthwhile to illustrate some less intuitive cases:

   ORIGINAL     PATCH                       RESULT
   ----------   -------------------------   ----------------

1. {"e":null}   {"a":1}                     {"e":null,"a":1}

2. {}           {"a":{"bb":{"ccc":null}}}   {"a":{"bb":{}}}

1. shows that a field not mentioned in a patch (eg "e") is unchanged, even when it has a null value.

2. shows that a patch that superficially appears only to be removing a nested field (eg "ccc") can actually create the parent objects on the way to that nested field.

P.S. It might make the examples a bit more readable if "a", "b", "c" where only used as field names, not values (eg {"a":1} instead of {"a":"b"}). It might also be a bit more readable if the same field always had the same value in the original column (eg "a":1, "b":2, "c":[3,1,4], "d":{"dd":{"ddd":4}}, "e":null). 

James Manger