Repository navigation
Honor documented default: and stop reading route.desc - #990
Merged
Merged
Conversation
Danger ReportNo issues found. |
numbata
force-pushed
the
fix/default-response-and-drop-route-desc
branch
from
November 3, 2026 12:31
0046162 to
182aa96
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The review found no active issues, with regression coverage and documentation updates supporting the response-option compatibility and route-description behavior changes.
No open issues 🎉
What changed in this PR
Updates grape-swagger to honor the documented default: response option while preserving default_response: compatibility, and stops treating route.desc as a Swagger summary.
Changes:
- Supports both
default_response:and legacydefault:response options, preferringdefault_response:. - Removes
route.descsummary handling in favor of thedescDSL andsummary:. - Updates documentation, changelog entries, compatibility helpers, and regression coverage.
| File | Description |
|---|---|
UPGRADING.md |
Documents default-response spelling and route description behavior changes. |
spec/swagger_v2/namespaced_api_spec.rb |
Tests descriptions from the desc DSL and passthrough desc: behavior. |
spec/swagger_v2/api_swagger_v2_response_with_models_spec.rb |
Adds coverage for the documented default: spelling. |
spec/support/grape_version.rb |
Detects Grape versions that remap default: to default_response:. |
README.md |
Updates default-response documentation and examples. |
lib/grape-swagger/endpoint.rb |
Supports both default-response keys and removes route.desc reads. |
CHANGELOG.md |
Records the behavior changes for the upcoming release. |
Review effort: Lite
The README documented desc ..., default: but grape-swagger only read default_response:, so the documented spelling was a silent no-op. route.default cannot be the fallback: it is OrderedOptions / Hash#default and answers nil even when the key is set. Read default_response first, then settings[:description][:default], which is where Grape < 4 keeps it. Also 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. The default: example runs on every supported Grape, with the deprecation Grape 4 emits for it silenced.
numbata
force-pushed
the
fix/default-response-and-drop-route-desc
branch
from
November 10, 2026 14:32
182aa96 to
87e5b87
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The changes address the documented response-option compatibility and route-description behavior, with corresponding regression tests and updated documentation showing no active review issues.
No open issues 🎉
1 resolved since last review
Review effort: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #989. Follow-up from #987.
Summary
The README told users to document a default response with
desc ..., default:, but the gem silently ignored that spelling and only honoreddefault_response:. With this change both spellings work, and the README now recommendsdefault_response:. Separately,get '/', desc: '…'no longer produces a swagger summary; that option was never Grape'sdescDSL, so users should writedesc '…'orsummary:.Root cause
The code read
route.default_response, while the README documenteddefault:.route.defaultcannot serve as a fallback: it resolves toOrderedOptions/Hash#defaultand answersnileven when the key is set. The fallback therefore readsroute.settings[:description][:default], which is where Grape 2.x/3.x keep it. Grape 4 remapsdefault:ontodefault_response:itself and deprecates it, so the fallback only matters on Grape < 4.For
route.desc: Grape'sdescDSL stores:description, andget '/', desc:is a passthrough onto the route, so reading it as a summary was accidental behavior.Drawbacks
get '/', desc: '…'stops producing asummarywith no runtime warning. This is documented in UPGRADING and the CHANGELOG, but users who relied on it will see the summary disappear.default:is read silently on Grape 2.x/3.x until grape-swagger 3.0; there is no warning for that spelling there.Rejected alternatives
route.default: alwaysnilfor this key, see above.desc:ordefault:: adds code to paths that are being retired, anddefault:users on Grape 4 already get Grape's own deprecation.default:outright: would turn a documented spelling into a hard break in a minor release.