Re: [apps-discuss] merge-patch: nulls in arrays

James M Snell <jasnell@gmail.com> Wed, 22 May 2013 01:06 UTC

Return-Path: <jasnell@gmail.com>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0EE5921F933B for <apps-discuss@ietfa.amsl.com>; Tue, 21 May 2013 18:06:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=-0.000, BAYES_00=-2.599, HTML_MESSAGE=0.001, NO_RELAYS=-0.001]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 62OsilNmBvPR for <apps-discuss@ietfa.amsl.com>; Tue, 21 May 2013 18:06:19 -0700 (PDT)
Received: from mail-ob0-x230.google.com (mail-ob0-x230.google.com [IPv6:2607:f8b0:4003:c01::230]) by ietfa.amsl.com (Postfix) with ESMTP id A72B021F92F4 for <apps-discuss@ietf.org>; Tue, 21 May 2013 18:06:19 -0700 (PDT)
Received: by mail-ob0-f176.google.com with SMTP id wp18so1534405obc.7 for <apps-discuss@ietf.org>; Tue, 21 May 2013 18:06:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5LmqhnylQ3+TuyIsoMpup46kSM7hhrbmByqruf2F10Y=; b=cC1P2JoX0mhkq2sfTFY/Nu2Gb81VgKMu3vIidq+uA3qqDqtZ9wgeqkaDag4pR2oXgm S+6MbZ/OnFTaYZC27paAJrH72J1B0fAp7vkm13aCItteliOUzWeXvFn9idQjZrMGbuza dh8vPztSx3hsPtcrVtvNsa/2agww9V36JRYtOdbJUszuGBhkmvmASxDA4+dsaOG3eVDB NsM4H2/dQVlwyvgb+zxXbN2SN4goqkvce0YDBi/nJoGdDjJbEC+wgloSMcOL3OlcLDIC /PoALQim5w4S+wgxTvyT2X0fXlA4T2LYHhLufY7E6S8Ju1je7XQbADvzGWzxygFdM1lO r7cw==
MIME-Version: 1.0
X-Received: by 10.60.92.41 with SMTP id cj9mr3187233oeb.31.1369184779155; Tue, 21 May 2013 18:06:19 -0700 (PDT)
Received: by 10.60.3.137 with HTTP; Tue, 21 May 2013 18:06:19 -0700 (PDT)
Received: by 10.60.3.137 with HTTP; Tue, 21 May 2013 18:06:19 -0700 (PDT)
In-Reply-To: <255B9BB34FB7D647A506DC292726F6E1151A7E2142@WSMSG3153V.srv.dir.telstra.com>
References: <20130520233353.30961.30740.idtracker@ietfa.amsl.com> <CABP7RbepmzSWRbWX_6r6hynGgrjz4OFq=WYbhLgz3HFNEp4O6w@mail.gmail.com> <255B9BB34FB7D647A506DC292726F6E1151A6C84BF@WSMSG3153V.srv.dir.telstra.com> <CABP7Rbf_M6xVCQAfsyd8_jsAv3sdeD4cjSiKWYktXnx1ccCmuA@mail.gmail.com> <255B9BB34FB7D647A506DC292726F6E1151A7E2142@WSMSG3153V.srv.dir.telstra.com>
Date: Tue, 21 May 2013 18:06:19 -0700
Message-ID: <CABP7RbeRMSYAzW-=V2f9n5BJemWN3xnPxpJQ0zHupg_wHs2bJA@mail.gmail.com>
From: James M Snell <jasnell@gmail.com>
To: James H Manger <James.H.Manger@team.telstra.com>
Content-Type: multipart/alternative; boundary="047d7b33d31c64bf2304dd442c05"
Cc: IETF Apps Discuss <apps-discuss@ietf.org>
Subject: Re: [apps-discuss] merge-patch: nulls in arrays
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: Wed, 22 May 2013 01:06:21 -0000

Alternatively, one can simply not send a merge patch with null array
elements.

At this point, however, it's just you and I talking back and forth.  Let's
let others have a chance to weigh in on it.
On May 21, 2013 5:44 PM, "Manger, James H" <James.H.Manger@team.telstra.com>
wrote:

> > <James.H.Manger@team.telstra.com> wrote:
> > [snip]
> > >
> > > It is pointless making the receiver of a patch remove nulls-within-
> > an-array just to get a result that is identical to the sender of the
> > patch simply not including those nulls-within-an-array in the first
> > place.
> > >
> > > The spec says "JSON arrays are treated the same as JSON primitives".
> > This should be reflected in the processing rules (and then the test
> > case). Implementations shouldn't need to look inside arrays.
>
> James Snell wrote:
> > The spec also states that Null specifically that "The JSON null value
> > is given a special meaning to indicate the removal of an existing
> > value". A merge-patch document should not include any null values
> > unless it is specifically intending to remove something from the target
> > document. The fact that nulls in arrays were not appropriately dealt
> > with previously is a spec bug, not a feature ;-) ...
>
>
> Removing nulls in arrays means the patch process can be described in 2
> stages:
>
> Stage 1: Walk through objects and arrays in the patch removing any nulls
> inside arrays, resulting in a modified patch.
>
> Stage 2: Walk through objects in the document and modified patch together
> -- adding, replacing or deleting object elements.
>
> Stage 1 adds zero functionality. Starting with the modified patch achieves
> an identical result. Stage 1 does adds extra work (extra code, extra time)
> for the patch processor. No (legitimate) patches will ever include
> nulls-in-arrays that they have zero impact on the result. The likely
> consequence is that the extra code to remove those null will be implemented
> poorly, if at all.
>
> Stage 1 removes some functionality. It further restricts the JSON values
> that can be created by a merge-patch.
>
> If the rationale is that "all nulls are special", then silently removing
> them from patches is not appropriate. It would be more appropriate to
> change stage 1 to throw an error if a patch includes any nulls in an array.
>
> Dropping stage 1 is the sensible approach.
>
> --
> James Manger
>