Skip to content

Commit ea98aa8

Browse files
soranobaLeFnord
authored andcommitted
FIX description field (required) may be null (#656)
* FIX description field (required) may be null * update CHANGELOG
1 parent 1d14091 commit ea98aa8

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* [#641](https://github.com/ruby-grape/grape-swagger/pull/641): Exclude default success code if http_codes define one already - [@anakinj](https://github.com/anakinj).
1515
* [#651](https://github.com/ruby-grape/grape-swagger/pull/651): Apply `values` and `default` of array params to its items - [@yewton](https://github.com/yewton).
1616
* [#654](https://github.com/ruby-grape/grape-swagger/pull/654): Allow setting the consumes for PATCH methods - [@anakinj](https://github.com/anakinj).
17+
* [#656](https://github.com/ruby-grape/grape-swagger/pull/656): Fix `description` field may be null - [@soranoba](https://github.com/soranoba).
1718

1819
* Your contribution here.
1920

lib/grape-swagger/endpoint.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def summary_object(route)
143143
def description_object(route)
144144
description = route.description if route.description.present?
145145
description = route.options[:detail] if route.options.key?(:detail)
146+
description ||= ''
146147

147148
description
148149
end
@@ -192,6 +193,7 @@ def response_object(route)
192193
codes.map! { |x| x.is_a?(Array) ? { code: x[0], message: x[1], model: x[2] } : x }
193194

194195
codes.each_with_object({}) do |value, memo|
196+
value[:message] ||= ''
195197
memo[value[:code]] = { description: value[:message] }
196198
next build_file_response(memo[value[:code]]) if file_response?(value[:model])
197199

0 commit comments

Comments
 (0)