Subject: [apps-discuss] JSON patch: "test" operation

From: Julian Reschke <[email-masked]>
Date: Wed, 30 Nov 2011 16:22:14 +0100

Hi,

this came up during discussions of patch formats on the Apache 
jackrabbit-dev mailing list:

Would it make sense to add a "test" operation that allows checking the 
state of the JSON object to be modified?

It would be consistent with other diff formats that use context 
information in order to check whether the patch "cleanly applies".

An example would be:

    [
          { "test": "/vsn", "value" : 17 },
          { "replace": "/vsn", "value" : 18 },
          { "replace": "/balance", "value": 1234 }
    ]

And yes, concurrency control can also be achieved using conditional HTTP 
methods, but that doesn't mean that they don't make sense in the patch 
format as well.

Best regards, Julian

---

From: "Paul C. Bryan" <[email-masked]>
Date: Wed, 30 Nov 2011 09:09:12 -0800

Yes, assert/equals/test has been mentioned in the past. As you point
out, HTTP preconditions to handle this to some extent. I've avoided
adding it thus far mostly because I haven't had a single concrete use
case outside of HTTP. Given at least the pattern of multiple requests
wanting to test a value for equality, I think I have enough data to add
it to the next revision of the spec. Consider it added.

Paul 

On Wed, 2011-11-30 at 16:22 +0100, Julian Reschke wrote:

> _______________________________________________
> apps-discuss mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/apps-discuss

---

From: mike amundsen <[email-masked]>
Date: Wed, 30 Nov 2011 12:27:10 -0500

Julian:

Is the thinking that _clients_ should tell servers to test an
insert/update?  IOW, clients would want to see test results?  A "dry run"
scenario?

Also, was there any talk about how servers would handle failed tests (HTTP
Response code, etc.)? If one or more tests fail, would the server have the
option of making the changes and then returning a list of success/fail
information?

mca
http://amundsen.com/blog/
http://twitter.com@mamund
http://mamund.com/foaf.rdf#me

On Wed, Nov 30, 2011 at 12:09, Paul C. Bryan <[email-masked]>wrote:

> **
> Yes, assert/equals/test has been mentioned in the past. As you point out,
> HTTP preconditions to handle this to some extent. I've avoided adding it
> thus far mostly because I haven't had a single concrete use case outside of
> HTTP. Given at least the pattern of multiple requests wanting to test a
> value for equality, I think I have enough data to add it to the next
> revision of the spec. Consider it added.
>
> Paul
>
> apps-discuss mailing [email-masked]://www.ietf.org/mailman/listinfo/apps-discuss
>
>
>

---

From: TianLinyi <[email-masked]>
Date: Thu, 01 Dec 2011 07:17:13 +0000

Hi, All

I think test would make it complicated. The test could result in <, >, <=, >=, = conditions.

If we want something like HTTP If-Match mechanism, I would think it should not be in the JSON patch. We should keep JSON patch simple. The status code is better to be delivered in the protocol layer who delivers the JSON patch document.

Cheers,
Linyi

From: [email-masked] [mailto:[email-masked]] On Behalf Of mike amundsen
Sent: Thursday, December 01, 2011 1:27 AM
To: Paul C. Bryan
Cc: IETF Apps Discuss
Subject: Re: [apps-discuss] JSON patch: "test" operation

Julian:

Is the thinking that _clients_ should tell servers to test an insert/update?  IOW, clients would want to see test results?  A "dry run" scenario?

Also, was there any talk about how servers would handle failed tests (HTTP Response code, etc.)? If one or more tests fail, would the server have the option of making the changes and then returning a list of success/fail information?

mca

On Wed, Nov 30, 2011 at 12:09, Paul C. Bryan <[email-masked]<mailto:[email-masked]>> wrote:
Yes, assert/equals/test has been mentioned in the past. As you point out, HTTP preconditions to handle this to some extent. I've avoided adding it thus far mostly because I haven't had a single concrete use case outside of HTTP. Given at least the pattern of multiple requests wanting to test a value for equality, I think I have enough data to add it to the next revision of the spec. Consider it added.

Paul

Hi,

An example would be:

    [

    ]

format as well.

Best regards, Julian

[email-masked]<mailto:[email-masked]>

_______________________________________________
apps-discuss mailing list
[email-masked]<mailto:[email-masked]>
https://www.ietf.org/mailman/listinfo/apps-discuss