Skip to content

Commit 286b82a

Browse files
committed
Merge pull request ruby-grape#610 from klausmeyer/fix-group-params
allow :type parameter on group param keyword - closes ruby-grape#605
2 parents 6058ea0 + 5462001 commit 286b82a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Next Release
3636
* [#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).
3737
* [#585](https://github.com/intridea/grape/pull/585): Fix after boot thread-safety issue - [@etehtsea](https://github.com/etehtsea).
3838
* [#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).
39+
* [#610](https://github.com/intridea/grape/pull/610): Fixed group keyword was not working with type parameter - [@klausmeyer](https://github.com/klausmeyer/).
3940

4041
0.6.1 (10/19/2013)
4142
==================

lib/grape/validations.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ def optional(*attrs, &block)
132132
push_declared_params(attrs)
133133
end
134134

135-
def group(element, &block)
136-
requires(element, &block)
135+
def group(*attrs, &block)
136+
requires(*attrs, &block)
137137
end
138138

139139
def params(params)

spec/grape/api_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,13 @@ def self.call(object, env)
19481948
}
19491949
]
19501950
end
1951+
it 'allows to set the type attribute on :group element' do
1952+
subject.params do
1953+
group :foo, type: Array do
1954+
optional :bar
1955+
end
1956+
end
1957+
end
19511958
it 'parses parameters when no description is given' do
19521959
subject.params do
19531960
requires :one_param, desc: "one param"

0 commit comments

Comments
 (0)