Does the input to json patch always needs to be an object, not array? I see the method from_diff only accepts objects. Is there a way to get the patch if top level is an array.
def test_apply_patch_to_copy(self):
src = [{'foo': 'bar', 'boo': 'qux'}]
dst = [{'baz': 'qux', 'foo': 'boo'}]
patch = jsonpatch.make_patch(src, dst)
res = patch.apply(src)
self.assertTrue(src is not res)
File "/Users/xx/python-json-patch/jsonpatch.py", line 311, in from_diff
return cls(list(compare_dicts([], src, dst)))
File "/Users/xx/python-json-patch/jsonpatch.py", line 306, in compare_dicts
'value': dst[key]}
TypeError: list indices must be integers, not dict
Does the input to json patch always needs to be an object, not array? I see the method
from_diffonly accepts objects. Is there a way to get the patch if top level is an array.