ditto
ditto copied to clipboard
Add support to post arbitraty json-formatted metadata with a key of `/`
If updating a (complex) property it'd be useful to add an arbitrary json object as metadata of the property written in the request. In order to do this it has to be supported to use a key of / which is currently not supported. Ditto will complain that a metadata requires a path.
In contrast, without this it is required to decompose the json object containing the metadata and create multiple entries for the put-metadata header to achieve the same thing.
I also agree that this should be made possible (and can be very convenient), however with the following limitations/restrictions:
- when using
"/"as"key"for putting metadata, the value must be a JsonObject - all of the included JSON paths in the provided JsonObject must also be present as part of the modification of the thing
E.g.:
{
"topic": "com.acme/foo-1/things/twin/commands/modify",
"headers": {
"put-metadata": [
{
"key": "/",
"value": {
"attributes": {
"location": {
"latitude": {
"type": "double"
},
"longitude": {
"type": "double"
}
}
}
}
}
]
},
"path": "/",
"value": {
"thingId": "com.acme:foo-1",
"attributes": {
"location": {
"latitude": 44.673856,
"longitude": 8.261719
}
}
}
}