Skip to content

Add support for 'brackets' collection format #622

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jul 22, 2017

Conversation

korstiaan
Copy link
Contributor

Although not in the official spec, it is support by swagger-ui. The multi format (foo=a&foo=b) doesn't work with rack base apps (like rails). Rack wants it to look like foo[]a=&foo[]=b, which is exactly what the brackets format specifies.

@coveralls
Copy link

coveralls commented Jul 19, 2017

Coverage Status

Coverage remained the same at 97.644% when pulling 99d993a on korstiaan:add_brackets_collection_format into bb68d90 on ruby-grape:master.

@coveralls
Copy link

coveralls commented Jul 19, 2017

Coverage Status

Coverage remained the same at 97.644% when pulling bfe2dd0 on korstiaan:add_brackets_collection_format into bb68d90 on ruby-grape:master.

@LeFnord
Copy link
Member

LeFnord commented Jul 22, 2017

thanks @korstiaan

@LeFnord LeFnord merged commit d2b9f67 into ruby-grape:master Jul 22, 2017
hara-y-u pushed a commit to hara-y-u/grape-swagger that referenced this pull request Dec 8, 2017
* Add support for 'brackets' collection format

* Update changelog.md
LeFnord pushed a commit to LeFnord/grape-swagger that referenced this pull request Feb 9, 2019
* Add support for 'brackets' collection format

* Update changelog.md
@viral810
Copy link

viral810 commented May 9, 2022

@LeFnord Am I missing anything here? seems like this doesn't do anything except the fact that you can use collectionFormat: 'brackets' in documentation hash.

For example,

if param_type_is_array?(param_type)
            options[:is_array] = true
            name += '[]' if array_use_braces? # Shouldn't this also check the collectionFormat from the documentation?
          end

cc: @korstiaan @magni-

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants