-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Generated patch incorrect for Array replacement #1
Comments
Also uses edit distance to generate optimal seq for simple arrays. Fixes #1
Also uses edit distance to generate optimal seq for simple arrays. Fixes #1
Also uses edit distance to generate optimal seq for simple arrays. Fixes #1
I was having the same issue, so I used your fork in my project, but it didn't fix it for me. The issue I had, which seems to be the same as this, was if My fix was to sort "remove" operations alphabetically by path and also numerically by path index (in case index >=10) in descending order, so that in the scenario above, index 2 gets removed before index 1. Here are my changes. Would you be interested in a PR? |
Patch is welcome! |
Also uses edit distance to generate optimal seq for simple arrays. Fixes #1
Here is a case that produces buggy patch:
The generated patch is:
This results in an error. The problem seems to be that index 1 should be removed before index 0. If I reverse the order the generated patch works.
I tested patch generation using https://github.com/stefankoegl/python-json-patch library . This produces a valid patch:
https://gist.github.com/tamalsaha/e8b313aec8f8d8191bc01ba504247e30
I also tested against a node.js library here: https://json8.github.io/patch/demos/apply/ . I get the same issue.
The text was updated successfully, but these errors were encountered: