Skip to content

Commit

Permalink
Merge pull request #610 from klausmeyer/fix-group-params
Browse files Browse the repository at this point in the history
allow :type parameter on group param keyword - closes #605
  • Loading branch information
dblock committed Mar 29, 2014
2 parents 6058ea0 + 5462001 commit 286b82a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Next Release
* [#557](https://github.com/intridea/grape/pull/557): Pass `content_types` option to `Grape::Middleware::Error` to fix the content-type header for custom formats. - [@bernd](https://github.com/bernd).
* [#585](https://github.com/intridea/grape/pull/585): Fix after boot thread-safety issue - [@etehtsea](https://github.com/etehtsea).
* [#587](https://github.com/intridea/grape/pull/587): Fix oauth2 middleware compatibility with [draft-ietf-oauth-v2-31](http://tools.ietf.org/html/draft-ietf-oauth-v2-31) spec - [@etehtsea](https://github.com/etehtsea).
* [#610](https://github.com/intridea/grape/pull/610): Fixed group keyword was not working with type parameter - [@klausmeyer](https://github.com/klausmeyer/).

0.6.1 (10/19/2013)
==================
Expand Down
4 changes: 2 additions & 2 deletions lib/grape/validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def optional(*attrs, &block)
push_declared_params(attrs)
end

def group(element, &block)
requires(element, &block)
def group(*attrs, &block)
requires(*attrs, &block)
end

def params(params)
Expand Down
7 changes: 7 additions & 0 deletions spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,13 @@ def self.call(object, env)
}
]
end
it 'allows to set the type attribute on :group element' do
subject.params do
group :foo, type: Array do
optional :bar
end
end
end
it 'parses parameters when no description is given' do
subject.params do
requires :one_param, desc: "one param"
Expand Down

0 comments on commit 286b82a

Please sign in to comment.