Closed Ricardope3 closed 3 years ago
Having the same issue as @nflaig in #5793 (comment)
My code is like this
@param.array('skillNames', 'query', { type: 'string' }) skillNames: string[],
When I only add one element to the string array the following error is displayed
{
"error": {
"statusCode": 400,
"name": "BadRequestError",
"message": "Invalid data \"\" for parameter \"skillNames\".",
"code": "INVALID_PARAMETER_VALUE",
"details": [
{
"path": "",
"code": "type",
"message": "should be array",
"info": {
"type": "array"
}
}
]
}
}
The url that is being sended looks like this
curl -X GET "http://[::1]:3000/skills/report/{skillNames}?skillNames=elemOne"
@bajtos @dhmlau
Thanks for raising the issue. However, the specific issue you are referring has been resolved by this pull request
Closing as resolved. Thanks!
There is another issue I noticed that if you only pass one value e.g.
?numberArray=123
then it throws the error with the codeINVALID_PARAMETER_VALUE
and in details with the messageshould be array
, however?numberArray=123&numberArray=12345
works just fine.I also noticed that
?numberArray[]=123
works but thats different from how it used to work and also is not how the api explorer sends the values.Seems like there is a general issue with the
@param.array
with parameter locationquery
Originally posted by @nflaig in https://github.com/strongloop/loopback-next/issues/5793#issuecomment-703927426