Skip to content

Commit e9adc92

Browse files
texpertpeter scholz
authored and
peter scholz
committed
Fixed find_definitions_and_params to not add :description to definiti… (#450)
* Fixed find_definitions_and_params to not add :description to definitions if :description is mising on path. Spec of move_params updated. * [skip ci] Changelog entry added.
1 parent cc08c4c commit e9adc92

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#### Fixes
88

9+
* [#450](https://github.com/ruby-grape/grape-swagger/pull/438): Do not add :description to definitions if :description is missing on path - [@texpert](https://github.com/texpert).
910
* Your contribution here.
1011

1112
### 0.21.0 (June 1, 2016)

lib/grape-swagger/doc_methods/move_params.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def find_definition_and_params(path, verb)
4141

4242
move_params_to_new(name, params)
4343

44-
@definitions[name][:description] = path[:description]
44+
@definitions[name][:description] = path[:description] if path[:description]
4545
path[:parameters] << build_body_parameter(response.dup, name)
4646
end
4747

spec/lib/move_params_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545
describe 'find_definition_and_params' do
4646
specify do
4747
subject.instance_variable_set(:@definitions, definitions)
48-
subject.find_definition_and_params(found_path, :post)
48+
subject.find_definition_and_params(found_path[:post], :post)
4949
expect(definitions.keys).to include 'InBody'
50+
expect(definitions['postRequestInBody'].keys).to_not include :description
5051
end
5152
end
5253

0 commit comments

Comments
 (0)