-
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
Replace mistreats properties that are set to "undefined" #279
Comments
Tricky. A property set to The fact that a property is not inherited is not really relevant with respect to JSON Patch, so I don't believe that it is the appropriate way. It might risk properties that do exist (due to inheritance) to be wrongly identified as non existing. If you believe that the arguing is lacking or can provide further insight about the proper way to treat a property set to 'undefined', I am willing to reassess. Thanks |
I do agree that it could be argued that the target do exist, but a target does also exist if the property is defined by means rendering There are basically four ways of checking if a property exists. You could use If you stick to properties existing in Javascript, regardless of inheritance or if the property is defined using setters and getters, you should use the The problem with using
Closing, but can be reopened |
From the JSON patch spec (Section 4.3):
https://datatracker.ietf.org/doc/html/rfc6902#section-4.3
Here it says: "The target location MUST exist for the operation to be successful."
Now I've run into the following issue which is best explained with a screenshot from my debugging session:
![image](https://user-images.githubusercontent.com/1225659/129013873-05fa77a7-4dc3-4a15-adf7-f447bc9ce026.png)
As a consequence, when the code enters validation (line 198) I then get an
![image](https://user-images.githubusercontent.com/1225659/129014700-3f62997c-308c-4000-9890-caaf9a442f70.png)
OPERATION_PATH_UNRESOLVABLE
error:I think the check on line 191 should rather be done using
Object.hasOwnProperty()
... what do you think?The text was updated successfully, but these errors were encountered: