Subject: [apps-discuss] Question about draft-snell-merge-patch-08

From: Francis Galiegue <[email-masked]>
Date: Mon, 17 Feb 2014 06:54:04 +0100

Hello,

I have an implementation of said draft which basically works, but some
questions remain unclear with regards to applying patches to JSON
values which are not objects and null values in the patch.

Say we have JSON value:

true

and the patch reads:

{
    "foo": null
}

The draft says both that member "foo" should be considered undefined
and that the whole JSON value should be replaced by the patch. So,
what is the result of the above? Is it {} or { "foo": null }?

Similarly, if the patch were { "foo": { "bar": null } }, would the
result be { "foo": {} } or { "foo": { "bar": null } }?

Cheers,
-- 
Francis Galiegue, [email-masked]
JSON Schema in Java: http://json-schema-validator.herokuapp.com

---

From: "Manger, James" <[email-masked]>
Date: Mon, 17 Feb 2014 17:16:30 +1100

> what is the result of the above? Is it {} or { "foo": null }?

{} is the only result that makes sense to me.

> result be { "foo": {} } or { "foo": { "bar": null } }?

{ "foo": {} } is the sensible answer.

--
James Manger

---

From: Francis Galiegue <[email-masked]>
Date: Mon, 17 Feb 2014 07:48:53 +0100

Hello,

On Mon, Feb 17, 2014 at 7:16 AM, Manger, James
<[email-masked]> wrote:
[...]
> { "foo": {} } is the sensible answer.

OK, I have since noticed that the reference draft is
http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch-02, and
the text in this draft is more clear about that.

However, there is also that text in section 2, which kind of troubles
me, since there are no examples:

          [...] Any null member contained in a provided array MUST be
          ignored and treated as if the member was undefined, even
          within array or object members within the array.

Uhm. So, does this mean that if the value is:

[ 1, null, { "a": null } ]

then it really should be patched to:

[ 1, {} ]

?

Also, in point 1 (ie, both the patch and victim are arrays), it only
says that "Any null member contained in the merge patch MUST be
ignored and treated as if those members are undefined". What are
members here? Does that include array elements?

---

From: Francis Galiegue <[email-masked]>
Date: Mon, 17 Feb 2014 09:56:23 +0100

[...]
> members here? Does that include array elements?

OK, my bad, there are examples further down in the draft showing how
to deal with nulls.

Sorry for the noise,