json-patch/json-patch-tests

removing a nonexistent field should fail

norpan opened this issue · 3 comments

4.2.  remove

   The "remove" operation removes the value at the target location.

   The target location MUST exist for the operation to be successful.

so

    { "comment": "For remove, the target location MUST exist for the operation to be successful.",
      "doc": {"foo" : "bar"},
      "patch": [{"op": "remove", "path": "/baz"}],
      "error": "removing a nonexistent field should fail" }

The same goes for removing a too large array index.

bruth commented

Good observation. Can you submit a PR adding that test case?