if I call jsonpatch.generate() the first time it generates the patches normally, but modifies the observed object, so the subsequent calls to jsonpatch.generate() don't generate any patches. Is it intentional, or is it a bug?
Do you have any sample code to illustrate the issue? The intended behaviour is to generate patches for changes that follows the previous call to jsonpatch.generate(). I.e. the following chain of events should be true:
If this is not what you are experiencing, please let me know.
if this is the intended behavior than no problem. I was not aware the fact that calling generate() resets the internal state.
In my use case the user fills out an HTML form and when she clicks the submit button I call jsonpatch.generate() to generate the patches and I send those patches to the backend. But the data can be invalid, so the user has to modify it, she clicks the submit button again and in this case I expect jsonpatch.generate() to return all the modifications.
Fixed in 893e5f4 on master branch, soon to be released as version 0.5.0