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
Remove the dead format keyword from Grape::Router::Pattern
`Pattern#initialize` took a `format:` keyword and, in `extract_capture`,
constrained the mustermann `:format` capture with it. But nothing ever
passed a non-nil value: the endpoint stopped passing `format:` when the
vestigial `Grape::Endpoint::Options` `format` member was removed (#2779),
and grape-swagger's helper passes `format: nil`. It was also redundant —
a route's `:format` capture comes from the path suffix built by
`Grape::Path` (`(.json)` for a specific format, `(.:format)` otherwise),
not from the pattern.
Drop the keyword and the dead capture branch. `DEFAULT_CAPTURES` still
lists `format` (the path-derived capture) and `map_str` still serves
`version`, so matching is unchanged. `Grape::Router::Pattern.new(...,
format: …)` now raises `unknown keyword: :format`; corrected the
UPGRADING note that previously described it as an optional keyword.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@
9
9
*[#2777](https://github.com/ruby-grape/grape/pull/2777): Add `Grape::Endpoint#mounted_app` reader and `app:` keyword - [@ericproulx](https://github.com/ericproulx).
10
10
*[#2778](https://github.com/ruby-grape/grape/pull/2778): Rename `Grape::Endpoint`'s `for:` keyword to `api:` and expose `#api` - [@ericproulx](https://github.com/ericproulx).
11
11
*[#2779](https://github.com/ruby-grape/grape/pull/2779): Promote route metadata (`version`, `namespace`, `prefix`, `requirements`, `anchor`, `settings`) to `Grape::Router::Route` keyword arguments, and drop the unused `Grape::Endpoint::Options``format` member - [@ericproulx](https://github.com/ericproulx).
12
+
*[#2782](https://github.com/ruby-grape/grape/pull/2782): Remove the dead `format` keyword from `Grape::Router::Pattern` - [@ericproulx](https://github.com/ericproulx).
Copy file name to clipboardExpand all lines: UPGRADING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ What changed is the raw bag. `route.options` now holds only what was declared fo
58
58
59
59
The `:format` member was removed from the endpoint's internal `Options`. Nothing ever passed `format:` to `Grape::Endpoint.new` — `config.format` was always `nil` — so this has no runtime effect (the `(.:format)`/`(.json)` route suffix comes from `Grape::Path`, not from this value). But `Grape::Endpoint.new(..., format: …)` now raises `unknown keyword: :format` instead of silently ignoring it.
60
60
61
-
`Grape::Router::Pattern#initialize`still accepts `format:`— it remains a valid capture constraint — but it is now optional (`format: nil`).
61
+
`Grape::Router::Pattern#initialize`no longer accepts `format:`either. It was never given a non-`nil` value — a route's `:format`capture comes from the path suffix built by `Grape::Path`, not from the pattern — so the keyword was dead. `Grape::Router::Pattern.new(..., format: …)` now raises `unknown keyword: :format`.
0 commit comments