When provided with an invalid patch, like by forgetting to embed the operation in a list:
>>> import jsonpatch
>>> jsonpatch.JsonPatch({'op': 'add', 'path': '/foo', 'value': 'bar'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mdk/clones/meltygroup/kisee/.venv/lib/python3.8/site-packages/jsonpatch.py", line 561, in __init__
self._get_operation(op)
File "/home/mdk/clones/meltygroup/kisee/.venv/lib/python3.8/site-packages/jsonpatch.py", line 677, in _get_operation
op = operation['op']
TypeError: string indices must be integers
I'd prefer something like an InvalidJsonPatch here.
When provided with an invalid patch, like by forgetting to embed the operation in a list:
I'd prefer something like an
InvalidJsonPatch
here.