Skip to content

Support default_response and default in 2.3; stop reading route.desc #989

Description

@numbata

Follow-up from #987 for grape-swagger 2.3. Not blocked on Grape.

default: is ignored

The README "Default response" section documents desc ..., default: { ... }. The code has only ever read default_response:. The documented spelling silently produces no default response.

Grape's route.default cannot be the fallback: on released Grape it is OrderedOptions#default, i.e. Hash#default, so it is nil even when the :default key is set. Dual-support without going back to route.options is:

route.try(:default_response) || route.settings.dig(:description, :default)

try is nil when respond_to? is false, so this still works if Grape drops delegate_missing_to before a real default_response reader exists. settings is a real reader.

default_response: stays the preferred spelling. default: remains until grape-swagger 3.0. Grape HEAD already remaps default: onto default_response (ruby-grape/grape#2862); grape-swagger 3.0 can then read default_response only.

Stop reading route.desc

desc 'text' stores :description. route.desc is almost never set and is not a Grape reader. Drop summary = route.desc if route.desc in summary_object. Keep route.description, route.detail, and route.summary. No Grape reader for desc.

Out of scope

success / failure fallbacks stay until 3.0. No grape-swagger issue for adding a desc reader.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions