-
Problem report
-
Resolution: Unresolved
-
Trivial
-
None
-
4.4.0alpha2
Problem description: If an API parameter has only 1 possible valid value, and it is passed with an incorrect value, the error message refers to its possible values in plural, even though only 1 possible option is mentioned in it. For example, the error message obtained when specifying an incorrect value of "output" parameter of autoregistration.get API: "Invalid parameter \"/output\": value must be one of extend."
Furthermore, other get APIs don't have any validation for this parameter at all.
Steps to reproduce:
Send the following API:
{
"jsonrpc": "2.0",
"method": "autoregistration.get",
"params": {
"output": "incorrect_value"
},
"auth": "e5fef1c5302e22e4d4b56bafd621ac93",
"id": 1
}
Result:
"error": {
"code": -32602,
"message": "Invalid params.",
"data": "Invalid parameter \"/output\": value must be one of extend."
Expected:
"data": "Invalid parameter \"/output\": value must be equal to 'extend'."
Send any other get API with incorrect value of "output" parameter:
{
"jsonrpc": "2.0",
"method": "host.get",
"params": {
"output": "please_do_not_extend"
},
"auth": "e5fef1c5302e22e4d4b56bafd621ac93",
"id": 1
}
Result: a list of the referred entities ids is returned:
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10084"
},
{
"hostid": "10264"
}
],
"id": 1
}
Expected: an error stating that the passed 'extend' parameter value is incorrect should be returned, like in the case of autoregistration.get API.