New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
put-metadata does not work as expected since 3.x #1631
Comments
Hi @demetz There were some enhancements to metadata in Ditto 3.0, I assume some behavior may have changed. Could you please try using no trailing slash in the "key", so:
I could imagine that this somehow changed if Iook at the docs. |
unfortunately, same result: ditto returns a specifying a nested key (e.g. |
Could reproduce via sandbox: curl --location --request PUT 'https://ditto.eclipseprojects.io/api/2/things/org.eclipse.ditto:lamp01/features/LampFeature/properties/powerConsumption' \
--header 'Authorization: Basic ZGl0dG86ZGl0dG8=' \
--header 'put-metadata: [{"key":"unit","value": "Watts"}]' \
--header 'Content-Type: application/json' \
--data '23.23' Retrieving the metadata: curl --location --request GET 'https://ditto.eclipseprojects.io/api/2/things/org.eclipse.ditto:lamp01?fields=thingId%2Cfeatures%2C_metadata' \
--header 'Authorization: Basic ZGl0dG86ZGl0dG8=' Did not apply the metadata as expected ( {
"thingId": "org.eclipse.ditto:lamp01",
"features": {
"LampFeature": {
"properties": {
"powerConsumption": 23.23
}
}
},
"_metadata": {
"features": {
"LampFeature": {
"properties": {
"powerConsumption": {}
}
}
}
}
} As @demetz mentioned, using a nested key works: curl --location --request PUT 'https://ditto.eclipseprojects.io/api/2/things/org.eclipse.ditto:lamp01/features/LampFeature/properties/powerConsumption' \
--header 'Authorization: Basic ZGl0dG86ZGl0dG8=' \
--header 'put-metadata: [{"key":"test/unit","value": "Watts"}]' \
--header 'Content-Type: application/json' \
--data '23.23' Result: {
"thingId": "org.eclipse.ditto:lamp01",
"features": {
"LampFeature": {
"properties": {
"powerConsumption": 23.23
}
}
},
"_metadata": {
"features": {
"LampFeature": {
"properties": {
"powerConsumption": {
"test": {
"unit": "Watts"
}
}
}
}
}
}
} |
Any help on fixing this bug would be appreciated, I currently don't have the resources to work on a fix. |
Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
@demetz will be fixed in upcoming 3.4.0 release |
…ngle-property #1631 fix putting metadata on a single property did not work
We recently upgraded from 2.x to the latest version.
I am no longer able to set metadata for a single property:
Expected behavior: value is written and metadata is available
/features/myfeature/properties/myproperty/temperature/unit
Actual behavior: only value is written
The text was updated successfully, but these errors were encountered: