RFC Errata
RFC 6902, "JavaScript Object Notation (JSON) Patch", April 2013
Source of RFC: appsawg (app)
Errata ID: 4460
Status: Rejected
Type: Editorial
Publication Format(s) : TEXT
Reported By: Lucas Bickel
Date Reported: 2015-08-29
Rejected by: Barry Leiba
Date Rejected: 2015-08-29
Section 4.1 says:
However, the object itself or an array containing it does need to exist, and it remains an error for that not to be the case. For example, an "add" with a target location of "/a/b" starting with this document: { "a": { "foo": 1 } } is not an error, because "a" exists, and "b" will be added to its value. It is an error in this document: { "q": { "bar": 2 } } because "a" does not exist.
It should say:
However, the object itself or an array containing it does need to exist, and it remains an error for that not to be the case. For example, an "add" with a target location of "/a/b" starting with this document: { "a": { "foo": 1 } } is not an error, because "a" exists, and "b" will be added to its value. It is an error in this document: { "q": { "bar": 2 } } because "a" does not exist. Considering a target location of "/a/1" it should be not be an error in this document: { "a": [ "foo" ] } while the same "add" into this document will be an error: { "a": [ ] } because "/a/0" does not exist.
Notes:
Adding to an object has such a nice example that explains the error cases. I think adding to a sequential array should have one as well.
To my understanding this is already pretty clear from RFC6901, I feel it will make the spec easier to implement if we have an example right here.
--VERIFIER NOTES--
Thanks for the comment, Lucas. This is, though, not a report of an error, so as an errata report it is rejected. It is a reasonable suggestion that we should consider if a new version of the document is done. The comment is recorded in the JSON mailing list archive.