jsonpatch icon indicating copy to clipboard operation
jsonpatch copied to clipboard

Please adjust the array "remove" operations’ order in the patch result

Open substancettt opened this issue 3 years ago • 0 comments

Different from other operations, the array "remove" operations’ order should be descending by path index.

Origin: [{"id": 1, "title":"news 1"}, {"id": 2, "title":"news 2"}, {"id": 4, "title":"news 4"}] Target: [{"id": 1, "title":"news 1"}, {"id": 3, "title":"news 3"}] Current patch: [{"op":"remove","path":"/1"},{"op":"remove","path":"/2"},{"op":"add","path":"/1","value":{"id":3,"title":"news 3"}}]

It's better to be: [{"op":"remove","path":"/2"},{"op":"remove","path":"/1"},{"op":"add","path":"/1","value":{"id":3,"title":"news 3"}}]

substancettt avatar Nov 22 '22 10:11 substancettt