Closed
Description
In short, there is very simple case that fails:
from jsonpatch import apply_patch, make_patch
src = {'foo': [1, 3]}
dst = {'foo': [0, 3, 3, 2]}
print apply_patch(src, make_patch(src, dst))
That's possible because of reversed
statement at https://github.com/stefankoegl/python-json-patch/blob/master/jsonpatch.py#L244
If we remove it code above would work perfectly, but we'll break next case:
from jsonpatch import apply_patch, make_patch
src = {'foo': [1, 3]}
dst = {'foo': [0, 3, 3, 2]}
print apply_patch(dst, make_patch(dst, src))
In other words, we have to add items in ascending order and remove them in descending one. That's my code and my fault, I'll try to figure how to fix it in better way, just creating issue there to let you know about problem.
Metadata
Metadata
Assignees
Labels
No labels