We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hey folks,
I discovered that we get a internal error if we apply the following operations to a JSON:
[ { "op":"remove", "path":"/foo/1" }, { "op":"remove", "path":"/foo/2" } ]
Test case:
func TestApply(t *testing.T) { patch := `[ { "op": "remove", "path": "/foo/1" },{ "op": "remove", "path": "/foo/2" } ]` doc := `{ "foo": [ "bar", "qux", "baz" ] }` patchObj, err := DecodePatch([]byte(patch)) if err != nil { t.Errorf("unexpected error: %+v", err) } patchedJS, err := patchObj.Apply([]byte(doc)) if err != nil { t.Errorf("patchObj.Apply internal error occurred, %v", err) } t.Logf("patchedJS: %s", patchedJS) }
Output:
patchObj.Apply internal error occurred, error in remove for path: '/foo/2': Unable to access invalid index: 2: invalid index referenced
If multiple paths are removed, this exception will be reported.
The text was updated successfully, but these errors were encountered:
it also mentioned here: mattbaird/jsonpatch#30
Sorry, something went wrong.
In the latest version, the remove operation has been reversed.
Successfully merging a pull request may close this issue.
Hey folks,
I discovered that we get a internal error if we apply the following operations to a JSON:
Test case:
Output:
If multiple paths are removed, this exception will be reported.
The text was updated successfully, but these errors were encountered: