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

compareArray function return false path when a filed is removed from array of object #189

Open
shoaibjo opened this issue Nov 12, 2024 · 2 comments

Comments

@shoaibjo
Copy link

Expected Behavior

[{"op":"remove","path":"/1","value":{"name":"Test1"}},{"op":"remove","path":"/4","value":{"name":"Test5"}}]

Actual Behavior

[{"op":"remove","path":"/1","value":{"name":"Test1"}},{"op":"remove","path":"/3","value":{"name":"Test5"}}]

Steps to Reproduce the Problem

[ { "name": "Test0" }, { "name": "Test1" }, { "name": "Test3" }, { "name": "Test4" }, { "name": "Test5" }, { "name": "Test6" } ]
comparing to
[ { "name": "Test0" }, { "name": "Test3" }, { "name": "Test4" }, { "name": "Test6" }]

Specifications

As you can see Test1 on index 1 and Test5 on index 4 have been removed
Library Version:
Language (e.g. Java 1.8, Scala, etc):

@shoaibjo
Copy link
Author

image
Missing pos++; ratherput it after else condition if that is common for all

@shoaibjo
Copy link
Author

Trying to create test data for a fix found another issue

source: ["test1","test2","test3"]
target: []
[{"op":"remove","path":"/0"},{"op":"remove","path":"/0"},{"op":"remove","path":"/0"}]
Which instate it should give path to each node

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

1 participant