-
Notifications
You must be signed in to change notification settings - Fork 147
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
Invalid diff created when DiffFlags.OMIT_COPY_OPERATION is omitted #104
Comments
Confirmed. Looking into it |
Interim investigation shows that, as one would expect, this line turned out to be a really bad idea :-)
I'm still trying to figure out exactly what this does and why, I imagine it'll have to be rewritten with a bunch of unit tests for future proofing. |
As far as I can tell the copy calculation mechanism is fundamentally broken; it finds nodes in the document that stay the same (position/value) after applying the patch, and makes a few assumptions about whether or not they're valid to use. The problem is, copy ops source from the current document as the patch is being applied, meaning that assumption can always be busted. I'm currently researching a cleaner solution where the diff algorithm actually keeps track of the available document state (you can track progress on my fork in the issue-104 branch). This will likely be quite expensive memory-wise, but will be optional with |
Hi all,
first thank you for that awesome library :)
We've encountered a bug where a diff created via
^ In other words the generated diff is invalid. An exception is thrown when applying the diff...
Expected Behavior
Given source and target json.
Then target equals JsonPatch.apply(JsonDiff.asJson(source, target), source)
Actual Behavior
thrown exception: [COPY Operation] Missing field xxx
If you create the diff via
it works but the diff might get big...
Specifications
Library Version: (0.4.5-SNAPSHOT until current) 0.4.9
Language (e.g. Java 1.8, Scala, etc): JAVA11
Steps to Reproduce the Problem
This is tricky - I wasn't able to reduce the problem further:
The text was updated successfully, but these errors were encountered: