python-json-patch icon indicating copy to clipboard operation
python-json-patch copied to clipboard

Raises KeyError when no "path" has been specified

Open frederikaalund opened this issue 6 years ago • 0 comments

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.

frederikaalund avatar Jul 16 '18 13:07 frederikaalund