ruby-grape / ruby-grape/grape-swagger

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

Open Beginner friendly
#989 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README's “Default response” section and the summary_object entry point. Trace the existing route metadata handling, then verify that both default_response: and default: produce a default response while summary generation no longer consults route.desc; keep description, detail, and summary behavior intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.