Re: [apps-discuss] draft-snell-merge-patch-08 in Ruby

James M Snell <jasnell@gmail.com> Mon, 20 May 2013 16:38 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 014F321F93BC for <apps-discuss@ietfa.amsl.com>; Mon, 20 May 2013 09:38:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.607
X-Spam-Level:
X-Spam-Status: No, score=-6.607 tagged_above=-999 required=5 tests=[AWL=-3.008, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
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 OJkA+vw3FRwc for <apps-discuss@ietfa.amsl.com>; Mon, 20 May 2013 09:38:25 -0700 (PDT)
Received: from mail-oa0-f48.google.com (mail-oa0-f48.google.com [209.85.219.48]) by ietfa.amsl.com (Postfix) with ESMTP id CDB6521F937E for <apps-discuss@ietf.org>; Mon, 20 May 2013 09:38:25 -0700 (PDT)
Received: by mail-oa0-f48.google.com with SMTP id i4so7908939oah.21 for <apps-discuss@ietf.org>; Mon, 20 May 2013 09:38:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=GYa0nqxgCYAaB28vKFH3DJTy58DuhbpCFa/J7dfJdrg=; b=B485nnLVH8y/qhYPUnBVm1VBPw1MHtjYqFqqxW5l2mpvyFFeALQ3XCMo0ALmdSizbs ZYn6epd3IMrl+TO0wEBgYksx2zddAmUd07817zWDkoEFifIQJ33y/pVNYdLAchEwMmnG 05YBZ+9gutR1XgDJEod6gx4NkK+07H9mn+nGQjPReRzc5adFnAqZFyOmZUdnVTWYwJJ9 pAUTab7YlICO5zW2jtl33gLFB/MnSsb5/3fgHJh7p3it8O/MzvoyR7af3WWOZpgtgeE4 ouB1vDiW9DJBgxiZDk73bPCCH9pr+KEk0iq+orFNkBr4AoxxiU+IjWCRmGD2o0TOm+hw jZFQ==
X-Received: by 10.60.140.166 with SMTP id rh6mr9545213oeb.97.1369067905267; Mon, 20 May 2013 09:38:25 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.60.3.137 with HTTP; Mon, 20 May 2013 09:38:05 -0700 (PDT)
In-Reply-To: <CABL+ZB6=X9vTwDZ9ORPWm9u7PNSaaisLvenSRifmjsO6BCOuxA@mail.gmail.com>
References: <CABL+ZB6AQGp8WUeH=HZrfm4VCQnmYFQB5vBGP0yghAZUhsjCQg@mail.gmail.com> <255B9BB34FB7D647A506DC292726F6E1151A34C59E@WSMSG3153V.srv.dir.telstra.com> <CABL+ZB6tkggqrdjPFz38j=AXGuueSbANzER24Njm-o3a2S=MZA@mail.gmail.com> <255B9BB34FB7D647A506DC292726F6E1151A56E41B@WSMSG3153V.srv.dir.telstra.com> <CABL+ZB6=X9vTwDZ9ORPWm9u7PNSaaisLvenSRifmjsO6BCOuxA@mail.gmail.com>
From: James M Snell <jasnell@gmail.com>
Date: Mon, 20 May 2013 09:38:05 -0700
Message-ID: <CABP7Rbc7VxOG3Y7zapNQ2oW=yO9=PitACzRLntzXXnQ1dj+04A@mail.gmail.com>
To: Steve Klabnik <steve@steveklabnik.com>
Content-Type: text/plain; charset="UTF-8"
Cc: "apps-discuss@ietf.org" <apps-discuss@ietf.org>
Subject: Re: [apps-discuss] draft-snell-merge-patch-08 in Ruby
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: Mon, 20 May 2013 16:38:30 -0000

I may need to take another pass at explaining this in the draft.
Essentially the idea is this: In the PATCH document, a null always
means that the key or element must not appear in the final result.

Given James M's example cases, the results should be:

> Document + patch = ?

> [1,2]  +  {"a":"foo","b":null}

  Result: {"a":"foo"}

> {"a":"foo"}  +  {"b":[3,null,{"x":null}]}

  Result: {"a":"foo", "b":[3,{}]}

> {"a":"foo"}  +  null

  Result: Invalid. The patch document MUST be a valid JSON document,
which means the root must be either a JSON object or array. A null
patch document is invalid.

If there is an error in the javascript impl in the draft, I'll make
sure that gets corrected in the next iteration.

- James

On Sun, May 19, 2013 at 9:00 PM, Steve Klabnik <steve@steveklabnik.com> wrote:
[snip]
>
>> Why both removing array elements that are null (obj.compact)?
>
> I took that to be what this meant:
>
>        Any
>        object member contained in the provided data whose value is
>        explicitly null is to be treated as if the member was undefined.
>
> Since 'null' means 'remove' as the value of a key, I just assumed all
> nulls should be removed. I did find this sentence (which is
> everywhere) a tad bit confusing.
>
> This could be me mis-reading things.
> _______________________________________________
> apps-discuss mailing list
> apps-discuss@ietf.org
> https://www.ietf.org/mailman/listinfo/apps-discuss