Re: [apps-discuss] more feature requests, was: JSON patch: "test" operation

Julian Reschke <> Fri, 30 December 2011 10:41 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id A0BF521F8B40 for <>; Fri, 30 Dec 2011 02:41:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -103.341
X-Spam-Status: No, score=-103.341 tagged_above=-999 required=5 tests=[AWL=-0.742, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id znF1o++kQ-eV for <>; Fri, 30 Dec 2011 02:41:27 -0800 (PST)
Received: from ( []) by (Postfix) with SMTP id A4A3421F8B1F for <>; Fri, 30 Dec 2011 02:41:26 -0800 (PST)
Received: (qmail invoked by alias); 30 Dec 2011 10:41:25 -0000
Received: from (EHLO []) [] by (mp072) with SMTP; 30 Dec 2011 11:41:25 +0100
X-Authenticated: #1915285
X-Provags-ID: V01U2FsdGVkX1969G0j+Ch6JLa43fTCfQqF6CNyK2A8EBeh65jCVL L4Z1hapQfMtL44
Message-ID: <>
Date: Fri, 30 Dec 2011 11:41:15 +0100
From: Julian Reschke <>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1
MIME-Version: 1.0
To: Sam Johnston <>
References: <> <> <> <> <> <> <1322779521.1958.1.camel@neutron> <> <1325222688.18477.25.camel@neutron> <>
In-Reply-To: <>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: 8bit
X-Y-GMX-Trusted: 0
Cc: IETF Apps Discuss <>
Subject: Re: [apps-discuss] more feature requests, was: JSON patch: "test" operation
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: Fri, 30 Dec 2011 10:41:27 -0000

On 2011-12-30 11:09, Sam Johnston wrote:
> On Fri, Dec 30, 2011 at 6:24 AM, Paul C. Bryan <
> <>> wrote:
>     First, I think commit messages should probably be out of scope for
>     JSON Patch specifically. That said, we should allow the ability to
>     build on the specified format, allowing for extensions, including
>     additional (more domain-specific) operations.
> Maybe so, but saying what you're doing when manipulating an object is
> often a good idea.
>     I'm generally against the idea of using out-of-band metadata such as
>     header fields in an HTTP request, mostly because it ties metadata to
>     the transfer protocol rather (what I believe rightly should be tied
>     to the document).
> The distinction between data and metadata isn't always clear — to me a
> document detailing manipulations could just as easily be separated from
> the description of it (or it could be redundant — with the headers
> reflecting data contained within the document). It's also not always
> possible to define what goes in a document, so if you have metadata
> (like commit messages) then I'd argue you should use HTTP's existing
> metadata channel rather than an "envelope" like SOAP (or JSON).

I think both are valid points of view :-)

As a data point: when I submit a hg patch to Mozilla, I specify the 
commit message in-band. I think that's a very useful thing to have.

>     I'm interested in feedback on the possibility that I add text
>     stating that if an operation cannot be determined for a given patch
>     object, then an implementation should ignore it. Thoughts?
> To me this sounds dangerous — add versioning and if there's sufficient
> demand for extensions then just include them in a future version?

So yes, we need to state whether the format follows the 
"must-understand" or "must-ignore" pattern. Or allow optional parameters 
(such as a commit message) to be marked as such.

>>     2) The ability to *copy* (not *move*) objects around.
>     This is another example of something trivial for the patch
>     implementation to perform, so I'm inclined to add it to the next draft.
> This begs the question as to whether PATCH should be creating new
> resources; the scope of PATCH ("to modify an existing HTTP resource") is

Of course that depends on how you define the lifetime of a resource. 
Does a resource which currently doesn't have a retrievable 
representation "exist"?

Technically, PATCH can work for creating an initial mapping as well.

> fairly clear on this IMO. Furthermore, MOVE and COPY verbs are useful
> for other applications (e.g. cloud APIs) so promoting them from WebDAV,
> sans XML dependency, would likely be useful for other applications.

I agree that COPY and MOVE are good things if you indeed want to COPY or 
MOVE full resources (or hierarchies). I never understood the resistance 
to COPY and MOVE in the AtomPub community.

That being said: the proposal is for copying JSON object members, not 
HTTP resources; so this is an operation that can't be done with COPY 
unless you have HTTP mappings for each of the JSON object members (and 
even then you wouldn't be able to express them as part of a bigger PATCH 

Best regards, Julian