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

Not Recognizing Moves in Collections #108

Open
BrandonDudek opened this issue Oct 2, 2019 · 4 comments
Open

Not Recognizing Moves in Collections #108

BrandonDudek opened this issue Oct 2, 2019 · 4 comments

Comments

@BrandonDudek
Copy link

Expected Behavior

If an entry in a collection changes index in a collection, it should be reported as a move.

Actual Behavior

It is being reported as a replace.

Steps to Reproduce the Problem

JsonDiff.asJson(new ObjectMapper().valueToTree("[1, 2, 3]"), new ObjectMapper().valueToTree("[2, 1, 3]"));

Specifications

zjsonpatch 0.4.9
Java 1.8
jackson 2.9.7

@holograph
Copy link
Collaborator

To clarify, the result is [{"op":"replace","path":"","value":"[2, 1, 3]"}], which is a valid diff. As things stand we don't have a clear-cut strategy for diff generation (e.g. smallest, fastest-to-diff, fastest-to-apply...), so any decision is equally correct and idiotic :-)

@holograph
Copy link
Collaborator

I'm pretty comfortable closing this, unless anyone wants to pick up the discussion and try to formalize the different strategies and/or how to implement them...?

@BrandonDudek
Copy link
Author

Since the current implementation is technically correct, but I would argue that what I was looking for would be "more correct".
Can this issue be changed from a Bug to a Feature Request? (There could even be a DiffFlags option.)

@holograph
Copy link
Collaborator

Oh I don't disagree (maybe just about the "level of correctness" assertion), and this can definitely by a worthwhile feature requests, but I think it bears defining a bit more carefully what these options are designed to accomplish.

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