RFC Errata
RFC 6902, "JavaScript Object Notation (JSON) Patch", April 2013
Source of RFC: appsawg (app)
Errata ID: 4787
Status: Held for Document Update
Type: Technical
Publication Format(s) : TEXT
Reported By: Daniel Frey
Date Reported: 2016-08-25
Held for Document Update by: Alexey Melnikov
Date Held: 2017-02-23
Section 4.2 says:
The "remove" operation removes the value at the target location. The target location MUST exist for the operation to be successful. For example: { "op": "remove", "path": "/a/b/c" } If removing an element from an array, any elements above the specified index are shifted one position to the left.
It should say:
The "remove" operation removes the value at the target location. The target location MUST exist for the operation to be successful. For example: { "op": "remove", "path": "/a/b/c" } If removing an element from an array, any elements above the specified index are shifted one position to the left. The target location MUST NOT be a reference to the root. It is an error in this document: { "op": "remove", "path": "" }
Notes:
The semantics of { "op": "remove", "path": "" } are never specified. If we allow to remove the root element, what would the result be? It would no longer be a valid JSON document, hence I propose to explicitly require the path of the "remove" operation to not reference the root.
Mark Nottingham: This isn't an errata; it would require gaining consensus and updating the document. See also: https://github.com/json-patch/json-patch2