Skip to content

Commit

Permalink
#91 Regression spec for empty field with parameter group
Browse files Browse the repository at this point in the history
  • Loading branch information
davetapley committed Jul 14, 2014
1 parent 10b9b49 commit c18719f
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions spec/form_params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ class FormParamApi < Grape::API
{}
end

params do
requires :required_group, type: Hash do
requires :required_param_1
requires :required_param_2
end
end
post '/groups' do
{}
end

add_swagger_documentation
end
end
Expand Down Expand Up @@ -83,4 +93,33 @@ def app
]
}
end

it 'retrieves the documentation for group parameters' do
get '/swagger_doc/groups.json'

JSON.parse(last_response.body).should == {
'apiVersion' => '0.1',
'swaggerVersion' => '1.2',
'resourcePath' => '/groups',
'basePath' => 'http://example.org',
'produces' => ['application/json'],
'apis' => [
{
'path' => '/groups.{format}',
'operations' => [
{
'notes' => '',
'summary' => '',
'nickname' => 'POST-groups---format-',
'method' => 'POST',
'parameters' => [
{ 'paramType' => 'form', 'name' => 'required_group[required_param_1]', 'description' => nil, 'type' => 'string', 'required' => true, 'allowMultiple' => false },
{ 'paramType' => 'form', 'name' => 'required_group[required_param_2]', 'description' => nil, 'type' => 'string', 'required' => true, 'allowMultiple' => false }],
'type' => 'void'
}
]
}
]
}
end
end

0 comments on commit c18719f

Please sign in to comment.