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

Julian Reschke <julian.reschke@gmx.de> Mon, 12 December 2011 09:25 UTC

Return-Path: <julian.reschke@gmx.de>
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 514FC21F8A67 for <apps-discuss@ietfa.amsl.com>; Mon, 12 Dec 2011 01:25:36 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.63
X-Spam-Level:
X-Spam-Status: No, score=-104.63 tagged_above=-999 required=5 tests=[AWL=-2.031, 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 HNHw3KSXzGiA for <apps-discuss@ietfa.amsl.com>; Mon, 12 Dec 2011 01:25:35 -0800 (PST)
Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by ietfa.amsl.com (Postfix) with SMTP id 6329621F8A64 for <apps-discuss@ietf.org>; Mon, 12 Dec 2011 01:25:34 -0800 (PST)
Received: (qmail invoked by alias); 12 Dec 2011 09:25:33 -0000
Received: from p5DCC85B1.dip.t-dialin.net (EHLO [192.168.178.36]) [93.204.133.177] by mail.gmx.net (mp021) with SMTP; 12 Dec 2011 10:25:33 +0100
X-Authenticated: #1915285
X-Provags-ID: V01U2FsdGVkX1+b6/dPkH+bm8ZkpWRn+da4BlFeEFPauT55Nax6LV 2QZ7gOgZRbWjey
Message-ID: <4EE5C88A.7080606@gmx.de>
Date: Mon, 12 Dec 2011 10:25:30 +0100
From: Julian Reschke <julian.reschke@gmx.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: "Roy T. Fielding" <fielding@gbiv.com>
References: <0B1C718E-60C2-4F89-967B-7532C9AC96F7@algesten.se> <1F9D18A1-D326-457E-BD36-619E3CF93AAE@gbiv.com>
In-Reply-To: <1F9D18A1-D326-457E-BD36-619E3CF93AAE@gbiv.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
Cc: Martin Algesten <martin@algesten.se>, 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: Mon, 12 Dec 2011 09:25:36 -0000

On 2011-12-12 00:03, Roy T. Fielding wrote:
> 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 think the question here is whether Javascript is used to generate (1) 
and to process (2) the format.

For (1), it should work with XHR. JSON-Patch just is a 
JSON-serialization of a JavaScript object. The author won't need to 
write a serializer. In JSOP's diff format, the author will have to 
combine custom elements with serialized Javascript objects. As such, the 
JSON parts of the diff format shouldn't make assumptions about 
Javascript that may not be true, such as member ordering (right now it 
does sort of).

For (2), the question of what parses the format is much more 
interesting. Sure, it won't be a browser. But with JSON Patch, it can be 
an off-the-shelf JSON library (such as Jackson).

Finally, two general points:

1) I'm not sure why verbosity is a problem. If it is, we can always 
Transfer/Content-encode gzip. For readability, we could switch from 
names like "add" to symbols like "+".

2) Compact formats can be a success; see Relax NG Compact Notation. I 
think the lesson to learn here is that there should be a 1-1 mapping 
between the compact notation and the verbose notation. That's currently 
not the case for JSOP's diff format, and I believe that's a problem.

Best regards, Julian