I have updated the Wiki page with an IETF ABNF variant of the JSOP Diff
syntax.
Open questions are:
- JSON Patch (the IETF spec) allows set operations with objects; JSOP
Diff didn't need it yet (as it's for overwriting properties); we
probably should allow it in order to remove the mismatch (same for "test")
- are pointers escaped the same way as in JSON Pointers or not? As we do
not need "/" in names, we probably can get away without escaping, but
then JSOP-Diff wouldn't be able to express all JSON-Patch documents
- extensibility / metadata are not addressed yet
As a next step we should document the mapping between these two formats
(while noting the remaining differences). That way we can define the
semantics of a JSOP-Diff instance in terms of JSON Patch, we should be
on the IETF Standards Track in the not-to distant future.
Best regards, Julian
-------- Original Message --------
Subject: [Jackrabbit Wiki] Update of "Jsop" by JulianReschke
Date: Fri, 23 Mar 2012 16:51:21 -0000
From: Apache Wiki <wikidi...@apache.org>
Reply-To: d...@jackrabbit.apache.org
To: Apache Wiki <wikidi...@apache.org>
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Jackrabbit Wiki"
for change notification.
The "Jsop" page has been changed by JulianReschke:
http://wiki.apache.org/jackrabbit/Jsop?action=diff&rev1=43&rev2=44
STRING ::= /* See RFC 4627, Section 2.5 */
NUMBER ::= /* See RFC 4627, Section 2.4 */
}}}
+
+ IETF ABNF variant:
+ {{{
+ diffs = *( ws ( add / set / remove / move / copy / test ) ws )
+
+ add = "+" ws pointer ws ":" ws ( object / atom / array )
+ copy = "*" ws pointer ws ":" ws pointer
+ move = ">" ws pointer ws ":" ws pointer
+ remove = "-" ws pointer
+ set = "^" ws pointer ws ":" ws ( atom / array ) ; object?
+ test = "?" ws pointer ws ":" ws ( atom / array ) ; object?
+
+ atom = string / number / false / null / true
+
+ pointer = string
+
+ ; JSON
+ array = <see RFC4627, Section 2.3>
+ false = <see RFC4627, Section 2.1>
+ null = <see RFC4627, Section 2.1>
+ number = <see RFC4627, Section 2.4>
+ object = <see RFC4627, Section 2.2>
+ string = <see RFC4627, Section 2.5>
+ true = <see RFC4627, Section 2.1>
+ ws = <see RFC4627, Section 2.1>
+ }}}
+
+
A
[[http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/json/JsopParser.java?view=markup|parser]],
and a simple
[[http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/json/JsopParserTest.java?view=markup|test
case]] for this syntax is available from the sandbox.
Also available are a
[[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java?view=markup|tokenizer]],
a
[[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java?view=markup|builder]],
and a
[[http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java?view=markup|Jsop
writer / reader]]. Those implementations are token based, and therefore
not limited to the JSOP format described here.