reject null op/path/from fields in json_patch_apply

This commit is contained in:
Javid Khan
2026-07-16 12:55:41 +05:30
parent 0ea5f6c615
commit eed664e06a
3 changed files with 29 additions and 1 deletions
+12
View File
@@ -542,6 +542,18 @@
"patch": [{"op": "copy", "from": "/a", "path": "/b"},
{"op": "copy", "from": "/b", "path": "/a/p/x"}],
"expected": {"a": {"p": {"x": {"p": {}}}}, "b": {"p": {}}}
},
{ "comment": "null op field must be rejected, not dereferenced",
"doc": {"foo": "bar"},
"patch": [{"op": null, "path": "/foo"}],
"error": "a null op field should fail rather than crash"
},
{ "comment": "null from field must be rejected, not dereferenced",
"doc": {"foo": "bar"},
"patch": [{"op": "move", "from": null, "path": "/foo"}],
"error": "a null from field should fail rather than crash"
}
]