-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Clarify whether / how Edit[]
can be concatenated
#53
Comments
The results of multiple A different API is needed that would let you compute the text operations for more than one JSON modification. I don't have plans to implement such functionality. I tried to improve the spec around edit operations. |
Thanks! Would it be possible to add one more sentence to the
I think even with your improvements that is currently still not clear. |
Thanks for the suggestion, I added it! |
The documentation currently does not make it clear whether or how
Edit[]
from multiplemodify()
orformat()
calls can be concatenated before being applied usingapplyEdits()
.Both the documentation for
modify()
andformat()
contains the following:Personally I think this documentation should be moved to
applyEdits()
respectively to the documentation of the typeEdit
instead since it is more relevant there.The issue is that the output of multiple
modify()
calls cannot be concatenated without risking to produce malformed JSON when callingapplyEdits()
. Here are two examples (from #48 (comment)):This will cause both elements / properties to remove the same
,
, which in the end results in one character too much being removed:So currently the only safe usage of
modify()
andapplyEdits()
is to call both functions for every modification you want to make. It is not safe to try concatenating the result of multiplemodify()
calls. This is rather inefficient when a user wants to remove multiple properties.In case this is intended, then it should ideally be clarified in the documentation for the
modify()
(andformat()
?) function.The text was updated successfully, but these errors were encountered: