Rswag: Nested GET parameters?

Created on 28 Sep 2017  路  2Comments  路  Source: rswag/rswag

Is there some definition how to use nested GET parameters within tests?
This does not work:

parameter name: :checkboxes,
  in: :path,
  description: 'The values of marked checkboxes',
  type: :array,
  items: {
    type: :string
  }

the final I am trying to call URL looks like this: /?checkboxes[]=Value 1&checkboxes[]=Value 2

Thank you in advance!

Most helpful comment

Try the following ...

parameter name: :'checkboxes[]', in: :query, type: :array, collectionFormat: :multi

All 2 comments

Try the following ...

parameter name: :'checkboxes[]', in: :query, type: :array, collectionFormat: :multi

I had an error on Swagger UI with the definition of the array using collectionFormat: :multi.

Screenshot 2021-03-01 at 11 51 26

But with the schema defined like this it works.

      parameter name: :'apps[]',
                in: :query,
                required: false,
                type: :array,
                collectionFormat: :multi,
                schema: { type: 'array', items: { type: 'string' } }

Swagger UI is not able to render it properly.

Screenshot 2021-03-01 at 12 43 24

BTW it is still not OpenApi 3 compatible. https://github.com/rswag/rswag/issues/256#issuecomment-780240614

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PhilippeChab picture PhilippeChab  路  4Comments

johnmcdowall picture johnmcdowall  路  5Comments

hannesstruss picture hannesstruss  路  6Comments

richthedev picture richthedev  路  5Comments

salzig picture salzig  路  5Comments