Support for query params array
thebrownfox opened this issue · 2 comments
thebrownfox commented
When I try to use array in query parameters, I get this validation error. I think it's because it doesn't check against "search_fields[index]" (search_fields only).
ValidationError: "search_fields[0]" is not allowed
"search_fields": {
"name": "search_fields",
"in": "query",
"schema": {
"items": {
"type": "string"
},
"type": "array"
}
}
value:
{
search: "",
"search_fields[0]": "id",
results: "10",
page: "1",
"sort[0]": "id",
"sort[1]": "asc",
}
This might be related:
#199
thefoxie commented
Ok, my bad. For anyone who cannot find out why it's not working, you need to parse the params beforehand.
const server = new Hapi.Server({
query: {
parser: (query) => qs.parse(query),
},
});
dcharbonnier commented
Maybe we should do somethig similat to this #211