stefankoegl / python-json-patch

Applying JSON Patches in Python
https://python-json-patch.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
459 stars 97 forks source link

Raises KeyError when no "path" has been specified #88

Open frederikaalund opened 6 years ago

frederikaalund commented 6 years ago

The following patch

[
    {
        "op": "add"
    }
]

when applied via

modified_config_dict = jsonpatch.apply_patch(config_dict, patch)

rasies a KeyError because path is not found. I was expecting it to raise a (subclass of) jsonpatch.JsonPatchException.

Is this a bug or by design? If the latter is the case, then please reconsider this decision. I find it a lot easier to use a Python library when I know that all exceptions, that the API may raise, are a subclasses of a library-specific base exception.