Closed GuanqunYang193 closed 6 months ago
Indeed. That is the behaviour correct as described in Json Patch RFC 6902:
4.1.
add
The "add" operation performs one of the following functions, depending upon what the target location references:
o If the target location specifies an object member that does exist, that member's value is replaced.
If you want to check if the path exists, you can use test operation and combine it with add: 4.6 test operation
Indeed. That is the behaviour correct as described in Json Patch RFC 6902:
4.1. add The "add" operation performs one of the following functions, depending upon what the target location references: o If the target location specifies an object member that does exist, that member's value is replaced.
If you want to check if the path exists, you can use test operation and combine it with add: 4.6 test operation
Brilliant! Thanks!
In current implement, it seems if we add value to a pre-existed path, the old value will be overwrited. In order to identify the semantics of "add" and "update", should we check if the path already existed and throw exception.