You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Mete Atamel <ma...@adobe.com> on 2012/09/28 11:05:17 UTC

JSOP diff question

Hi, 

I have a question with JSOP diff syntax. Say I want to add a node "a" with
a property and value. This is the diff I use in the commit:

diff.append("+\"a\" : {\"prop\" : \"value\"}");

Is it legal to add "a" and then add its properties in 2 separate add
operations but in the same commit like this?

diff.append("+\"a\" : {}");
        diff.append("+\"a\" : {\"prop\" : \"value\"}");

Maybe it's not legal because it would try to add node "a" twice?

Also, is it legal to do the previous operation but with property in the
path like this?


        diff.append("+\"a\" : {}");
        diff.append("+\"a/prop\" : \"value\"");


Thanks,
Mete


Re: JSOP diff question

Posted by Stefan Guggisberg <st...@gmail.com>.

On 28.09.2012, at 11:05, Mete Atamel <ma...@adobe.com> wrote:

> Hi, 
> 
> I have a question with JSOP diff syntax. Say I want to add a node "a" with
> a property and value. This is the diff I use in the commit:
> 
> diff.append("+\"a\" : {\"prop\" : \"value\"}");
> 
> Is it legal to add "a" and then add its properties in 2 separate add
> operations but in the same commit like this?
> 
> diff.append("+\"a\" : {}");
>        diff.append("+\"a\" : {\"prop\" : \"value\"}");
> 
> Maybe it's not legal because it would try to add node "a" twice?
> 

correct, it should fail. 

> Also, is it legal to do the previous operation but with property in the
> path like this?
> 
> 
>        diff.append("+\"a\" : {}");
>        diff.append("+\"a/prop\" : \"value\"");
> 

this should work.

cheers
stefan

> Thanks,
> Mete
>