-
Notifications
You must be signed in to change notification settings - Fork 217
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
Undocumented behavior: jsonpatch.compare alters obj1 #93
Comments
Thanks for pointing that! I would said that from API purity perspective we should not update I think we may consider, if possible, adding a parameter for that. |
Agreed. Actually we addressed this problem before (there was a PR: #53), so that sounds like a regression. There is even a test for that: b2435fa#diff-2f9a66403e6f581b7b3abaff2c80ca45R694. Maybe the test is too naive. |
Isn't this fixed by #167? |
Looking at just code, I'm not so sure |
The
compare
function calls_generate
internally, which, in addition to generating a patches array, updates themirror
object to match theobj
object! This caught me by surprise and created a bunch of hard-to-debug problems.Please document this behavior in the API docs, or better yet, allow this behavior to be disabled (since now I have to make lots of deep clones every time I call
jsonpatch.compare
to keep it from messing with my program state...)The text was updated successfully, but these errors were encountered: