-
Notifications
You must be signed in to change notification settings - Fork 218
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
Strange behaviour! If path don't start with '/' #77
Comments
Hi! This is because it is not a correct path and code is optimized for speed, not for validating patches. To turn on validation, use Check out https://tools.ietf.org/html/rfc6901 for the spec of the path value. |
Oops! Just noticed that such path does not raise an error with validation. Reopening this for fixing |
Adding validation for paths starting with "/". Fixes issue #77.
@tomalec This can be closed now. Please do a patch release when you have time! Thanks! 👍 |
Thanks @MarkHerhold for support :) |
var obj = {firstName: "Albert"};
var patches = [{op: "add", path: "/lastName", value:"Wester"}];
jsonpatch.apply(obj,patches);
obj = {firstName: 'Albert' },lastName:'Wester' }
If path = "lastName"
The result
{ '0': 'W', '1': 'e', '2': 's', '3': 't', '4': 'e', '5': 'r' }
why?
The text was updated successfully, but these errors were encountered: