Handle empty subscription names parameter array
The requirement for the names field to be non-empty seems to be absurd. Add logic for handling empty names field
Example request:
{
"deviceGuids":["snappy-demo"],
"names":[],
"requestId":2,
"action":"notification/subscribe"
}
Response returned:
{
"action": "notification/subscribe",
"requestId": 2,
"code": 400,
"status": "error",
"error": "Names field is required to be nonempty"
}
Wwhat if you do not include "names" field at all in the json? If that works then providing field but not filling it may be considered as a validation feature/rule and thus not a bug.
This validation seems to be more inconvinient than usefull.
Names field is almost always hardcoded (device side) or supplied by the user (client side - web, mobile, desktop apps). This validation might be usefull only in rare cases such as when the names field is generated depending on the application environment.
So imagine you grab names from the user input (web ui, cli or whatever). You will initialize an array from the very first and than will push user inputs there. After that you will need to insert an if statement checking the array length and if you do not do this the application will fail.
Also for the names field I cannot imagine any differences between null, undefined or empty array.