|
Post by trajeswaran on Mar 28, 2019 18:50:08 GMT
As per the specification, 6.4.4.3. Update (PATCH)
"Within a PATCH request, unchanged members within a JSON array may be specified as empty JSON objects, and clearing members within a JSON array may be specified with null"
My question is whether a service can choose to support empty and null for PATCH request of array of complex types only. For PATCH request of array of simple types, it will go with replacement of existing members with the give set of new members. This may look odd. The point here is, it still confirms to the specification.
case 1: ====
"RemoteRoleMapping": [ {"LocalRole": "Administrator", "RemoteGroup": "Admingroup15"}, {"LocalRole": "Administrator1","RemoteGroup": "Admingroup13"} ]
To delete the second element: (supporting both empty and null)
----------------------------------
PATCH
"RemoteRoleMapping": [ {}, null ]
case 2: ===== "StaticNameservers": ["3.3.3.3","6.6.6.6"]
Replace the existing elements (not supporting null)
--------------------------------- PATCH
"StaticNameservers": ["6.6.6.6"]
Any comments will be highly appreciated.
|
|
|
Post by jautor on Apr 2, 2019 21:53:12 GMT
You should support all of these, otherwise you are likely to run into interoperability issues - the current version of the specification lists the null/empty element in language speaking from the point of the client, not the service. This is being corrected/clarified in the next version of the specification, to state that the service must support the null/empty element handling.
Your example of replacing all existing elements is correct - but that works because you've replaced the entire array with that PATCH (a single element of "6.6.6.6"), which is correct PATCH behavior.
Jeff
|
|
|
Post by trajeswaran on Apr 3, 2019 5:38:29 GMT
Thank you very much. You have made it clear. I appreciate.
|
|