Using wildcard in "put-metadata" header for PATCH / MergeThing command adds the metadata also for non-affected fields
When e.g. using the following put-metadata header:
[{"key":"*/createdAt","value": "now!"}]
On a HTTP request:
PATCH /api/2/things/my:thing-1
E.g. sending the payload:
{
"attributes": {
"only-one": 2
}
}
Will also lead to all existing fields in the Thing getting the metadata, e.g. as in:
{
"_metadata": {
"thingId": {
"createdAt": "now!"
},
"policyId": {
"createdAt": "now!"
},
"attributes": {
"only-one": {
"createdAt": "now!"
}
}
}
}
That is unexpected and should instead only modify the metadata of the provided fields to "PATCH".
@thjaeckle I would like to work on this issue. Could you please assign it to me?
@sejal-bansal cool, thanks This however is probably not trivial to fix, I would assume.
@sejal-bansal any update here? Do you work on this or shall I unassign the issue again?
Hi @thjaeckle, @sejal-bansal! I tried UpdateTwinWithLiveResponse mapper, [{"key":"/updated-via","value":"device-live-response"}] in put-metadata. I am facing error "message": "The wildcard expression '//updated-via' in header 'put-metadata' is not valid.", how to fix this and I want to get the detailed implementation to achieve this in doc i have seen { "dittoHeadersForMerge": { "if-match": "", "response-required": false, "put-metadata": [ {"key":"/updated-by","value":"{{ request:subjectId }}"}, {"key":"/updated-via","value":"device-live-response"}, {"key":"/update-hint","value":"{{ header:some-custom-hint }}"}, {"key":"*/updated-at","value":"{{ time:now }}"} ] } } this much config example was there. can anyone help to do this properly