You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two leftover reader-migration items we can do in grape-swagger 2.3 without waiting on Grape.
1. Documented default: is ignored
The README "Default response" section documents:
desc'thing',default: {message: 'the default response'}
The code has only ever read route.default_response. So the documented spelling is a silent no-op, and the spelling that works is undocumented (only in specs).
try(:default_response) keeps the working (undocumented) spelling without depending on delegate_missing_to forever (try is nil when respond_to? is false).
route.default looks like the matching Grape reader, but it is Hash#default: BaseRoute def_delegators :default onto @options, which is ActiveSupport::OrderedOptions < Hash. It always returns nil. Do not use it. route.settings is a real reader; :description already holds the Hash-form and block-form default: payload.
Do not go back to route.options[:…].
Document default_response: as the preferred form; note that default: still works until 3.0. grape-swagger 3.0 can drop the default: fallback once Grape adds default_response as a real desc key and aliases default onto it (see #987).
2. Stop reading route.desc
desc 'text' stores :description. route.desc is almost never set and is one of the four method_missing reads in #987. Drop summary = route.desc if route.desc in summary_object; keep route.description + route.detail + route.summary. No Grape reader for desc.
desc 'This returns something' with no detail/summary already puts that text in swagger description (api_swagger_v2_detail_spec.rb, detail: nil example).
Activity
numbata commentedon Sep 6, 2026
Duplicate of #989 — that issue already tracks this 2.3 work and is closed by #990.