Re: [apps-discuss] JSON Patch: jsondiff and syntax

"Roy T. Fielding" <fielding@gbiv.com> Sun, 11 December 2011 23:03 UTC

Return-Path: <fielding@gbiv.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 7620121F84A1 for <apps-discuss@ietfa.amsl.com>; Sun, 11 Dec 2011 15:03:08 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.599
X-Spam-Level:
X-Spam-Status: No, score=-106.599 tagged_above=-999 required=5 tests=[AWL=-4.000, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
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 QsGp0bfQUET7 for <apps-discuss@ietfa.amsl.com>; Sun, 11 Dec 2011 15:03:07 -0800 (PST)
Received: from homiemail-a85.g.dreamhost.com (caiajhbdcaib.dreamhost.com [208.97.132.81]) by ietfa.amsl.com (Postfix) with ESMTP id BB96221F848F for <apps-discuss@ietf.org>; Sun, 11 Dec 2011 15:03:07 -0800 (PST)
Received: from homiemail-a85.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a85.g.dreamhost.com (Postfix) with ESMTP id 4C2C2BC041; Sun, 11 Dec 2011 15:03:07 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gbiv.com; h=subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to; q=dns; s=gbiv.com; b=WCByKD0UkiB7hxo8 KvSkhHLDUrQmWefUsgxMTmJ8Vm9gxNVYALmE61cyS2I7BUON+DLmMwzJPngsLapd 9oYAJ3rSZnwgfZmHOgxHdO7lpDwAW9fv1vhXN/sXlIqSiHKzKKer8vtM7CdC08W3 VbPX7TU6sIkdmLST44+DD1diyc8=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gbiv.com; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=gbiv.com; bh=KcOrkzdKVsNDK2Thpd6kZA+5lLM=; b=ZvR0e4awlwgHzpVDUzYf/xlgg0CI +cXeNv9MRE9bOHRRbC2mg9TMQ9+MupZ9QCY1/8oDdnLLbmmiVKQ3sy2swtHdvrZ9 i+K0NmAGozN4mwI+BXTQVFuZKilq1PgbekI6xif6R1vnkTNa3KTGhsPBRz/GZn+D peZfL7dpEyaZaFo=
Received: from [192.168.1.84] (99-21-208-82.lightspeed.irvnca.sbcglobal.net [99.21.208.82]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: fielding@gbiv.com) by homiemail-a85.g.dreamhost.com (Postfix) with ESMTPSA id 33F71BC040; Sun, 11 Dec 2011 15:03:07 -0800 (PST)
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset="us-ascii"
From: "Roy T. Fielding" <fielding@gbiv.com>
In-Reply-To: <0B1C718E-60C2-4F89-967B-7532C9AC96F7@algesten.se>
Date: Sun, 11 Dec 2011 15:03:05 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <1F9D18A1-D326-457E-BD36-619E3CF93AAE@gbiv.com>
References: <0B1C718E-60C2-4F89-967B-7532C9AC96F7@algesten.se>
To: Martin Algesten <martin@algesten.se>
X-Mailer: Apple Mail (2.1251.1)
Cc: apps-discuss@ietf.org
Subject: Re: [apps-discuss] JSON Patch: jsondiff and syntax
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: Sun, 11 Dec 2011 23:03:08 -0000

FWIW, discussion of which format is best for a diff should really be based
on what is being compared (a file or an abstract memory structure?) and what
is expected to process the diff.

For example, JSOP has a diff format

  http://wiki.apache.org/jackrabbit/Jsop#Draft_Implementations:_JSOP-Diff

that should be evaluated based on comparing JCR repository trees and an
understanding that the main processor is going to be a server-side patch
implementation.  Given that context, our JSON represents a state of the
JCR repository: the actual diff format does not need to be JSON because
it won't be processed by a browser (only generated by XHR).

I happen to agree that choosing any verbose diff format is a non-starter,
even if we assume compression, though I have a hard time evaluating a
JSON diff proposal without a more concrete notion of what it is intended
to do and why anyone would want to use it.

....Roy


On Dec 10, 2011, at 7:05 PM, Martin Algesten wrote:

> (Sorry Paul C. Bryan, I'm stalking you from list to list. ;)
> 
> This is in reference to a discussion from a couple of days back 
> http://www.ietf.org/mail-archive/web/apps-discuss/current/msg03884.html
> 
> Parallel to Paul's work I've dreamt up another JSON patch syntax and implemented a diff/patch tool here:
> 
> https://github.com/algesten/jsondiff#readme
> 
> I don't agree that the verbosity of the JSON Patch RFC (http://tools.ietf.org/html/draft-pbryan-json-patch-04) is okay.
> 
> I believe one of the big reasons that JSON has gained such popularity over say XML, is the simplicity of it. The simplicity is gained by a loss of semantics or perhaps better call it "inferred" semantics. Such inference are even more obvious in other terse data exchange formats such as YAML.
> 
> JSON Patch goes against this by having very explicit verbs "add", "replace", "move" etc. I don't buy the argument that using gzip transfer encoding solves this. XML compresses amazingly well, but I rather see that as an argument that something is wrong in the format to start off with.
> 
> I also think about things like "diff -u" where the '+/-' becomes second nature and the patches are very readable. Currently a JSON Patch file is an instruction list of mutations - almost like a programming language, which for me is different to a diff. But then I'm clearly biased :)
> 
> Cheers,
> Martin
> _______________________________________________
> apps-discuss mailing list
> apps-discuss@ietf.org
> https://www.ietf.org/mailman/listinfo/apps-discuss