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

Steve Klabnik <> Mon, 20 May 2013 04:00 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 4681021F8F62 for <>; Sun, 19 May 2013 21:00:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.978
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id TbT+Fo0L+NEa for <>; Sun, 19 May 2013 21:00:14 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:4001:c03::22d]) by (Postfix) with ESMTP id B9D1621F8749 for <>; Sun, 19 May 2013 21:00:14 -0700 (PDT)
Received: by with SMTP id k5so12999386iea.18 for <>; Sun, 19 May 2013 21:00:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; 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 with SMTP id y2mr4038835igf.86.1369022414170; Sun, 19 May 2013 21:00:14 -0700 (PDT)
Received: by with HTTP; Sun, 19 May 2013 21:00:14 -0700 (PDT)
In-Reply-To: <>
References: <> <> <> <>
Date: Sun, 19 May 2013 21:00:14 -0700
Message-ID: <>
From: Steve Klabnik <>
To: "Manger, James H" <>
Content-Type: text/plain; charset="ISO-8859-1"
X-Gm-Message-State: ALoCoQlkL72E0XnJXw3ztGyWhRT5nuAXySeBvITjFbrSmMImZPJRJPKrYEb+w0wx42LmYFnF813K
Cc: "" <>
Subject: Re: [apps-discuss] draft-snell-merge-patch-08 in Ruby
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 20 May 2013 04:00:15 -0000

> 'null' is a valid JSON value.


(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
    from /Users/steve/.gem/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in
    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:

       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.