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 when rearranging #3

Open
Nikhilkranthi opened this issue May 6, 2022 · 0 comments
Open

Bug when rearranging #3

Nikhilkranthi opened this issue May 6, 2022 · 0 comments

Comments

@Nikhilkranthi
Copy link

Let us consider this code

import (
	"fmt"

	"github.com/herkyl/patchwerk"
)

func main() {
	a := `{"L1": ["A", "B","C"]}`
	b := `{"L1": ["C", "A","B"]}`
	patch, err := patchwerk.DiffBytes([]byte(a), []byte(b))
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(patch))
}

Output:
[{"op":"add","path":"/L1/0","value":"C"}]'

But the actual output of the patch should be
[{remove /L1/2 } {add /L1/0 C}]
Where C at index 2 is removed and C is added at index 0

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