Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsondiff 1.20 includes extraneous 'value' field for remove operation #76

Closed
ostackbrian opened this issue Dec 4, 2017 · 2 comments
Closed

Comments

@ostackbrian
Copy link
Contributor

This was detected by openstack/python-glanceclient unit tests. Here's a command line example:

$ cat has-friend.json
{ "name": "fred", "friend": "barney", "spouse": "betty" }
$ cat no-friend.json
{ "name": "fred", "spouse": "betty" }

$ jsondiff --version
jsondiff 1.20
$ jsondiff has-friend.json no-friend.json
[{"path": "/friend", "value": "barney", "op": "remove"}]

$ /usr/local/bin/jsondiff --version
jsondiff 1.16
$ /usr/local/bin/jsondiff has-friend.json no-friend.json
[{"path": "/friend", "op": "remove"}]

My reading of https://tools.ietf.org/html/rfc6902#section-4.2 is the 1.16 version is correct.

ostackbrian added a commit to ostackbrian/python-json-patch that referenced this issue Dec 4, 2017
RFC 6902 section 4.2 [0] does not define a 'value' field for
the 'remove' operation.  The commit "Merge _op_base classes
into PatchOperation classes" [1] introduced a 'value' field
in _item_removed() in the DiffBuilder class.  This patch
removes the 'value' field from the 'remove' operation, adds
a new test, and revises some other tests.

[0] https://tools.ietf.org/html/rfc6902#section-4.2
[1] stefankoegl@03aa14e
@ostackbrian
Copy link
Contributor Author

See pull request #77.

openstack-gerrit pushed a commit to openstack/requirements that referenced this issue Dec 5, 2017
jsonpatch 1.20 was released 25 Nov 2017 and added to upper-constraints
by change Ib49b7644cba86e2147176921356489a0d3729fee .  This version
currently breaks some glanceclient unit tests.  For an example, see
https://review.openstack.org/#/c/524821/

The problem is that jsonpatch 1.20 produces a remove operation that
is out of compliance with RFC 6902 [0] (whereas the previous version,
1.16, produced compliant output).  An issue has been filed
upstream [1] along with a patch to fix the issue [2].  In the
interim, we should revert to the previous version of jsonpatch.

[0] https://tools.ietf.org/html/rfc6902#section-4.2
[1] stefankoegl/python-json-patch#76
[2] stefankoegl/python-json-patch#77

Change-Id: I13c8f4e71841c4765bd0fff80858a2683602d1db
Closes-bug: #1736005
stefankoegl added a commit that referenced this issue Dec 30, 2017
Remove extraneous 'value' field for op:remove (#76)
@stefankoegl
Copy link
Owner

#77 has been merged, and version 1.21 has been released with this fix.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants