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

ruby-grape / grape / 26614103339 / 35
97%
master: 97%

Build:
DEFAULT BRANCH: master
Ran 29 May 2026 02:22AM UTC
Files 166
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

29 May 2026 02:20AM UTC coverage: 95.661% (-0.08%) from 95.742%
26614103339.35

push

github

web-flow
Generalize middleware options to per-class Data value objects (#2718)

Following the per-feature `VersionOptions` / `RescueOptions` work in #2712
and #2716, middlewares that want typed option accessors now declare a
per-class `Options = Data.define(...)`.

`Middleware::Base#initialize`, when the subclass declares an `Options`
constant (ancestor search included), routes the kwargs through
`Options.new(**options)`:

- `@config` exposes the typed Data instance (named accessors).
- `@options` keeps returning a frozen `Hash` representation
  (`config.to_h.freeze`) for back-compat with subclasses that read
  `options[:key]`.

Subclasses without an `Options` constant still flow through the
`DEFAULT_OPTIONS` Hash + `deep_merge` path (`Filter`, `Auth::*`) unchanged.

- `Middleware::Formatter` (5 fields).
- `Middleware::Error` (14 fields). `rescue_options:` defaults to
  `Grape::DSL::RescueOptions.new`; an explicit nil (passed by
  `Endpoint#error_middleware_options` when no `rescue_from` was called)
  is coerced to the default in the initializer.
- `Middleware::Versioner::Base` (7 fields). Adds `content_types:` /
  `format:` so the `PrecomputedContentTypes` mixin's accessor reads land
  cleanly. `version_options:` defaults to `Grape::DSL::VersionOptions.new`.

Each `Options` field list is alphabetic.

- `attr_reader :options` still returns a frozen `Hash` for converted
  middlewares (now derived from `config.to_h`). Subclasses that read
  `options[:key]` keep working.
- `DEFAULT_OPTIONS` is restored as `Options.new.to_h.freeze` on each
  converted middleware so existing references continue to resolve.
  Marked `@deprecated` in the YARD comment; will be removed in a future
  release.
- `Options#[]` is defined on each Data class as a Hash-style shim that
  emits a deprecation warning via `Grape.deprecator` and forwards to
  the named accessor — gives any code that discovers the Data and
  reaches in with `[:key]` a migration nudge.

Passing an unknown kwarg to a... (continued)

1074 of 1187 branches covered (90.48%)

Branch coverage included in aggregate %.

3490 of 3584 relevant lines covered (97.38%)

969.15 hits per line

Source Files on job run-3.3-gemfiles/rails_8_1.gemfile - 26614103339.35
  • Tree
  • List 166
  • Changed 5
  • Source Changed 5
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 26614103339
  • 571edbaa on github
  • Prev Job for on master (#26496466230.21)
  • Next Job for on master (#26614155237.30)
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