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

bug fix in move operation #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vishwakarma
Copy link

There was bug in factorization of diffs while finding pairs.
Example :
"first": { "b": [0, 1, 2] },
"second": { "b": [1, 2], "c": 0 ,"d":0}
patch obtained is :
{{ "op": "move", "from": "/b/0", "path": "/c"}, { "op": "move", "from": "/b/0", "path": "/d"}}
which is wrong, the correct patch generated should be
{ "op": "move", "from": "/b/0", "path": "/c"},{ "op": "add", "path": "/d", "value": 0}
There was bug in finding pair method, I have added necessary code fix for same.

@fge
Copy link
Collaborator

fge commented Oct 31, 2014

Uh, sorry, I only just noticed this pull request...

Does it also solve the other issue you mentioned?

@vishwakarma
Copy link
Author

Hi, the pull request doesn't solve all cases, it solve cases covered by shared example, The whole MOVE operation needs to revisit.

@vishwakarma
Copy link
Author

Hi, I have written java implementation names as zjsonpatch https://github.com/flipkart-incubator/zjsonpatch, it covers all cases which are currently missing in json-patch project.
Currently, This is being used in my some other project where daily 70+Million jsons are compared (checked for diff and applied same if diff found), this is live from last 3 months with no issues reported, Variations in json used are ranging from 5-300 keys with multiple level of nesting (array within object or vice-versa) and latency perceived is 99.9 percentile 1ms .

@fge
Copy link
Collaborator

fge commented Dec 19, 2014

@vishwakarma which cases are missing? None are missing. JSON Patch works and so does JSON Merge Patch.

And so does JSON Diff! It just doesn't optimize everything. But it works reliably.

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

Successfully merging this pull request may close these issues.

2 participants