Add a function for performing a JSON Patch.
Review Request #9264 - Created Oct. 12, 2017 and updated
djblets.util.json_utils.json_patch, an implementation
of JSON Patch (RFC 6902). This is another, more advanced method of
patching JSON-serializable data, sort of like with JSON Merge Patch but
with the ability to order operations, copy or move data, sanity-check
values before applying a patch, set values to
null, and manipulate
specific indices of arrays. It's a good substitute for JSON Merge
Patches when more specific modifications and sanity-checking is needed.
JSON Patches consist of a list of operations to perform. These are
test. All operations
must pass in order for a patch to apply.
This implementation goes beyond most implementations by providing read
and write access control for keys. This allows callers to prevent
reading certain keys or writing to others, limiting the damage that, for
instance, an API call can do.
More information on JSON Patch can be found at http://jsonpatch.com/ or
Unit tests pass.
- Improved documentation.
- Fixed alignment issues.
Revision 2 (+2690 -2)