Open skewty opened 11 months ago
Perhaps it is better to change the value of params to have a JSON object schema instead.
example:
{
"version": 2,
"deletedDeviceName": "Temp Device 1701728569"
}
instead of
Temp Device 1701728569
The schema / params change would also make sense for gateway_device_renamed
as well.
{
"version": 2,
"previousDeviceName": "Temp Device 1701728569",
"currentDeviceName": "My Device"
}
instead of
{ "Temp Device 1701728569": "My Device" }
Then params would always be a JSON object.
Looking further into RPC params and I see more inconsistencies.
Example: gateway stats uses camelCase (which is good / expected)
{
"eventsProduced": 0,
"eventsSent": 0
}
but gateway version uses snake_case (which is bad / unexpected)
{
"current_version": "0",
"latest_version": "0"
}
gateway devices should be an array of objects so it can be validated using JSON schema but instead it returns a mapping which is (bad / unexpected)
gateway ping uses a string which could be easily changed to
{
"version": 2,
"timestamp": "2023-12-05T11:40:12.431363Z"
}
It seems logical for all gateway responses to be a JSON object so they can share more code path.
Describe the bug The
params
value of RPC payload is not valid JSON whenmethod=gateway_device_deleted
is sent by back-end.To Reproduce
Expected behavior params field should have surrounding " character so it is valid JSON.
Docs at https://thingsboard.io/docs/user-guide/rpc/ state params field "value is a JSON.".
A string without surrounding quotes is not JSON.
This is a bug in your back-end and in your gateway.
This bug existed in 3.5. and continues to exist in 3.6..