Skip to content

Honor documented default: and stop reading route.desc - #990

Open
numbata wants to merge 5 commits into
masterfrom
fix/default-response-and-drop-route-desc
Open

Honor documented default: and stop reading route.desc#990
numbata wants to merge 5 commits into
masterfrom
fix/default-response-and-drop-route-desc

Conversation

@numbata

@numbata numbata commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Closes #989. Follow-up from #987.

Summary

  • The README documented desc ..., default: but the code only ever read default_response:, so the documented spelling was a silent no-op. 2.3 reads both: route.try(:default_response) (the spelling that already worked) then route.settings.dig(:description, :default) (the README spelling, through a real reader). route.default cannot be the fallback — it is OrderedOptions / Hash#default and answers nil even when the :default key is set. Prefer default_response:; default: remains until 3.0.
  • Stop reading route.desc. Grape's desc DSL stores :description. get '/', desc: '…' is a passthrough onto the route, not that DSL, and is no longer treated as a swagger summary. Use desc '…' or summary:.

Test plan

  • Spec for default_response: unchanged (api_swagger_v2_response_with_models_spec.rb and the primitive-types sibling).
  • Spec for README spelling default: (skipped on Grape HEAD, which remaps that key and warns).
  • Namespace specs now use desc '…' and assert swagger description; a dedicated example pins that get '/', desc: is not a summary.
  • Full RSpec suite passes locally (533 examples, 0 failures, 2 pending).
  • RuboCop clean on changed files.
  • CI green.

Made with Cursor

numbata and others added 2 commits September 7, 2026 00:07
The README spelling was a silent no-op because route.default is Hash#default.
Read default_response first, then the :default key via route.settings.
Drop route.desc so get '/', desc: is no longer treated as a swagger summary.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Danger Report

No issues found.

View run

numbata and others added 3 commits September 7, 2026 00:11
Same Style/DirectiveScope fix as #988; CI on this branch fails until those
pairs are gone, and that PR has not landed on master yet.

Co-authored-by: Cursor <cursoragent@cursor.com>
Grape 2.1.3 has no Grape::Util::ApiDescription, so evaluating
DSL_METHODS at describe-load time raised NameError and failed the
matrix row.

Co-authored-by: Cursor <cursoragent@cursor.com>
Grape 3.0.1 has the class but not that constant, so the previous guard
still raised NameError while loading the default: spec.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant