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

Steve Klabnik <steve@steveklabnik.com> Mon, 20 May 2013 04:00 UTC

Return-Path: <steve@steveklabnik.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 4681021F8F62 for <apps-discuss@ietfa.amsl.com>; Sun, 19 May 2013 21:00:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, 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 TbT+Fo0L+NEa for <apps-discuss@ietfa.amsl.com>; Sun, 19 May 2013 21:00:14 -0700 (PDT)
Received: from mail-ie0-x22d.google.com (mail-ie0-x22d.google.com [IPv6:2607:f8b0:4001:c03::22d]) by ietfa.amsl.com (Postfix) with ESMTP id B9D1621F8749 for <apps-discuss@ietf.org>; Sun, 19 May 2013 21:00:14 -0700 (PDT)
Received: by mail-ie0-f173.google.com with SMTP id k5so12999386iea.18 for <apps-discuss@ietf.org>; Sun, 19 May 2013 21:00:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=ApMe1KZrubK+pPP37JI7Vxg2TiOWAiqvXvVs8XCpIJ0=; b=ApKUT4//MHUMZZcuH4fqwA5AT9O11WjzlN5lRSqJWun6AbEiyqFV2YB3uf6i6aV08O 3c0nBTDFhOCNIW4NnmqVxnqywYYi/fzGIjs5ym+G4SIxClU0qPeF1Z9qimO39lINCwL4 xcv+MaiUHtwj5QkkLqrpPNOIILeQRUc38/q9shenEgGR5pi86xLUpffxLFfHnnHtkmNF NbT7PA8031VkqeddIVBu2OwHbyKyl0gi2n7vNa+q/HmyFHACKDAkkFXFUT6Tx1BkwNBN LhEgROzVNV9gEiiDF9UCAHbZUegS72ezapddvVRWq4jNOW/AcySUsUfo+zz7FE8Xw0tQ bc5g==
MIME-Version: 1.0
X-Received: by 10.50.25.2 with SMTP id y2mr4038835igf.86.1369022414170; Sun, 19 May 2013 21:00:14 -0700 (PDT)
Received: by 10.64.163.3 with HTTP; Sun, 19 May 2013 21:00:14 -0700 (PDT)
In-Reply-To: <255B9BB34FB7D647A506DC292726F6E1151A56E41B@WSMSG3153V.srv.dir.telstra.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>
Date: Sun, 19 May 2013 21:00:14 -0700
Message-ID: <CABL+ZB6=X9vTwDZ9ORPWm9u7PNSaaisLvenSRifmjsO6BCOuxA@mail.gmail.com>
From: Steve Klabnik <steve@steveklabnik.com>
To: "Manger, James H" <James.H.Manger@team.telstra.com>
Content-Type: text/plain; charset="ISO-8859-1"
X-Gm-Message-State: ALoCoQlkL72E0XnJXw3ztGyWhRT5nuAXySeBvITjFbrSmMImZPJRJPKrYEb+w0wx42LmYFnF813K
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 04:00:15 -0000

> 'null' is a valid JSON value.

Bummer:

(main):001:0> require 'json'
=> true
irb(main):002:0> JSON.parse("null")
JSON::ParserError: 757: unexpected token at 'null'
    from /Users/steve/.gem/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in
`parse'
    from /Users/steve/.gem/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in
`parse'
    from (irb):2
    from /opt/rubies/2.0.0-p0/bin/irb:12:in `<main>'

> JavaScript will happily accept JSON.parse('null').
> RFC4627 "JSON" limits application/json content to be an object or array, but my guess is that that will be relaxed to allow any JSON value shortly.

Ahhh, there we go. So it's not a valid JSON value. ;)


> Presumably the idea of this site was to return the result of the merge-patch. At the moment it is just echoing the patch.

Uh oh, that's a bummer. I'll look into that.

> 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.