jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Reschke <julian.resc...@gmx.de>
Subject Re: JSOP vs JSON-Patch, was: [Jackrabbit Wiki] Update of "Jsop" by stefan
Date Wed, 21 Mar 2012 15:28:50 GMT
On 2012-03-21 13:47, Stefan Guggisberg wrote:
> On Tue, Mar 20, 2012 at 6:53 PM, Julian Reschke<julian.reschke@gmx.de>  wrote:
>> Hi,
>>
>> so Stefan is cleaning up the JSOP Wiki page (thanks!).
>>
>> I think it's time to look again at the difference between the JSOP diff
>> format (as used in MK.commit()), and the IETF JSON Patch format, now
>> <http://trac.tools.ietf.org/html/draft-ietf-appsawg-json-patch-01>.
>>
>> JSOP has lost it's dependency on member ordering, and JSON Patch now has
>> "test" and "copy", so it seems the only missing gap is the metadata feature.
>
> WRT the set of operations (add, replace, copy et al) i agree that there's a
> nice 1:1 match.
> ...

Looking some more at 
<http://wiki.apache.org/jackrabbit/Jsop#Compact_Syntax>:

> // JSOP-Diff Proposal
> DIFFS     ::= (ADD | SET | REMOVE | MOVE | COPY | TEST | METADATA | EXTENSION)*
> ADD       ::= "+" STRING ":" (OBJECT | ATOM | ARRAY)
> SET       ::= "^" STRING ":" ATOM | ARRAY
> REMOVE    ::= "-" STRING
> MOVE      ::= ">" STRING ":" STRING
> COPY      ::= "*" STRING ":" STRING
> TEST      ::= "=" STRING ":" ATOM | ARRAY
> METADATA  ::= "@" OBJECT
> EXTENSION ::= OP STRING ":" (OBJECT | ATOM | ARRAY)
> OP        ::= /* any single character except for +, ^, -, >, *, =, @ */
>
> // JSON (RFC 4627)
> OBJECT   ::= "{" (PAIR ("," PAIR)*)? "}"
> PAIR     ::= STRING ":" VALUE
> VALUE    ::= COMPOUND | ATOM
> COMPOUND ::= OBJECT | ARRAY
> ATOM     ::= STRING | NUMBER | "true" | "false" | "null"
> ARRAY    ::= [ (VALUE ("," VALUE)*)? ]
>
> STRING   ::= /* See RFC 4627, Section 2.5 */
> NUMBER   ::= /* See RFC 4627, Section 2.4 */

It appears that this grammar notation somehow silently introduces 
whitespace between DIFFS and probably elsewhere. I believe this needs to 
be clarified; maybe if we move to IETF ABNF (RFC 5234), which would make 
sense as we borrow from the JSON ABNF anyway.

Another thing is that "SET" doesn't allow "OBJECT"; as far as I recall 
because it's designed for setting leaf nodes only. Would it be a problem 
to allow OBJECT here as well? Setting an OBJECT would be identical to a 
REMOVE-ADD sequence then...

Best regards, Julian

Mime
View raw message