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

diff() produces invalid patches for root replacements #12

Closed
Ereski opened this issue Jan 18, 2021 · 0 comments · Fixed by #18
Closed

diff() produces invalid patches for root replacements #12

Ereski opened this issue Jan 18, 2021 · 0 comments · Fixed by #18

Comments

@Ereski
Copy link

Ereski commented Jan 18, 2021

The following will fail with an invalid pointer error:

let mut a = serde_json::Value::from(0);
let b = serde_json::Value::from(1);
let patch = json_patch::diff(&a, &b);
json_patch::patch(&mut a, &patch).unwrap();

The problem is that diff() generates a replacement with / as the path, which then can't be applied.

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

Successfully merging a pull request may close this issue.

1 participant