0

Usecase: Hapi.js + hapi-swaggered + hapi-swaggered-ui.

Swaggered UI submits an array. It passes comma separated String instead of Array. How to I make it pass correct parameters, should I change validation type on Joi? I am using:

query: Joi.object({ categories : Joi.array().items(Joi.string()).label('Categories') })

Query it does: ?categories=firstCategory%2CsecondCategory

Query it should do: ?categories=firstCategory&categories=secondCategory

1 Answers1

0

There is no standard way of sending array in query param. And joi will not recognize it. Send it as payload. If you want to send it in query param, you will have to convert the query params into array and then validate.

vipulsodha
  • 624
  • 1
  • 9
  • 27