• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 26371140112 / 34
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: robust_mounted_app_comparison
DEFAULT BRANCH: master
Ran 24 May 2026 07:54PM UTC
Files 164
Run time 6s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 May 2026 07:51PM UTC coverage: 95.734%. Remained the same
26371140112.34

Pull #2746

github

ericproulx
Hoist `using:` / `except:` to explicit kwargs on requires / optional

`Grape::DSL::Parameters#requires` and `#optional` both treat `:using`
(and the `:except` it pairs with) as a method-local early-return signal:
when `:using` is set, the method returns through
`require_required_and_optional_fields` / `require_optional_fields` and
the keys never flow into `validate_attributes` or the validator/scope
machinery.

Promote them out of the `**opts` Hash into explicit kwargs:

  def requires(*attrs, using: nil, except: nil, **opts, &block)
  def optional(*attrs, using: nil, except: nil, **opts, &block)

The signature now self-documents the using/except contract instead of
burying it in opts, the `if using` guard drops one Hash lookup, and the
`opts` Hash that flows into `validate_attributes` is "validator-bound
kwargs only" — easier to reason about what propagates downstream.

Fully back-compat: Ruby kwarg matching captures `using:` / `except:`
before the `**opts` splat, so existing call sites (`requires :all,
using: docs`, `optional :all, except: %i[…], using: docs`, etc.) keep
working unchanged. The unrelated `:except_values` validator option
(consumed by `Grape::Validations::ValidationsSpec`) is a different key
and is unaffected.

Matches the recent kwargs-hoisting pattern in #2723 (`desc`) and #2728
(`auth` / `http_basic` / `http_digest`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2746: Hoist using: / except: to explicit kwargs on requires / optional

1064 of 1173 branches covered (90.71%)

Branch coverage included in aggregate %.

3492 of 3586 relevant lines covered (97.38%)

988.88 hits per line

Source Files on job run-3.2-gemfiles/rails_8_1.gemfile - 26371140112.34
  • Tree
  • List 164
  • Changed 1
  • Source Changed 1
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 26371140112
  • cbf759fa on github
  • Prev Job for on refactor/params-dsl-using-except-kwargs (#26292056269.37)
  • Next Job for on refactor/params-dsl-using-except-kwargs (#26468354687.3)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc