stefankoegl / python-json-patch

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

Expect path/from attributes also as JsonPoiner instances (#60) #75

Closed stefankoegl closed 6 years ago

stefankoegl commented 6 years ago

Expect the path and from attributes of patches also as JsonPointer instances.

As described in #60, if a user has these paths already in a pointer object, it needs to be serialized to a string just to be re-parsed within JsonPatch.

This avoids the unnecessary roundtrip and lets the user create patches like

    pointer = jsonpointer.JsonPointer('/foo')
    patch = jsonpatch.JsonPatch([                                           
        {'op': 'add', 'path': pointer, 'value': 'bar'},
    ])