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

ruby-grape / grape / 26370276319
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: robust_mounted_app_comparison
DEFAULT BRANCH: master
Ran 24 May 2026 07:12PM UTC
Jobs 38
Files 164
Run time 1min
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:12PM UTC coverage: 96.722% (-0.3%) from 96.977%
26370276319

Pull #2718

github

ericproulx
Generalize middleware options to per-class Data value objects

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(...)`.

## Mechanism

`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.

## Converted middlewares

- `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.

## Back-compat surface

- `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 `[... (continued)
Pull Request #2718: [DRAFT] Generalize middleware options to per-class Data value objects

1088 of 1179 branches covered (92.28%)

Branch coverage included in aggregate %.

31 of 37 new or added lines in 5 files covered. (83.78%)

10 existing lines in 3 files now uncovered.

3515 of 3580 relevant lines covered (98.18%)

31414.48 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
91.04
-3.28% lib/grape/middleware/error.rb
2
94.4
-3.14% lib/grape/middleware/formatter.rb
2
91.84
-8.16% lib/grape/middleware/versioner/base.rb

Coverage Regressions

Lines Coverage ∆ File
6
91.04
-3.28% lib/grape/middleware/error.rb
3
94.4
-3.14% lib/grape/middleware/formatter.rb
1
91.84
-8.16% lib/grape/middleware/versioner/base.rb
Jobs
ID Job ID Ran Files Coverage
1 run-3.2-gemfiles/rails_8_0.gemfile - 26370276319.1 24 May 2026 07:13PM UTC 164
95.48
GitHub Action Run
2 run-3.3-gemfiles/rails_8_0.gemfile - 26370276319.2 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
3 run-3.2-gemfiles/rack_3_0.gemfile - 26370276319.3 24 May 2026 07:13PM UTC 163
95.48
GitHub Action Run
4 run-3.3-gemfiles/rails_7_2.gemfile - 26370276319.4 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
5 run-4.0-gemfiles/rails_8_0.gemfile - 26370276319.5 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
6 run-4.0-gemfiles/grape_entity.gemfile - 26370276319.6 24 May 2026 07:13PM UTC 163
50.03
GitHub Action Run
7 run-4.0-gemfiles/grape_swagger.gemfile - 26370276319.7 24 May 2026 07:12PM UTC 163
55.0
GitHub Action Run
8 run-3.4-gemfiles/rails_8_0.gemfile - 26370276319.8 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
9 run-3.4-gemfiles/rails_7_2.gemfile - 26370276319.9 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
10 run-3.4-Gemfile - 26370276319.10 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
11 run-3.4-gemfiles/rack_3_2.gemfile - 26370276319.11 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
12 run-3.4-gemfiles/rack_2_2.gemfile - 26370276319.12 24 May 2026 07:13PM UTC 163
95.39
GitHub Action Run
13 run-3.2-gemfiles/rack_3_1.gemfile - 26370276319.13 24 May 2026 07:13PM UTC 163
95.48
GitHub Action Run
14 run-4.0-gemfiles/rack_3_2.gemfile - 26370276319.14 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
15 run-4.0-gemfiles/rack_3_1.gemfile - 26370276319.15 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
16 run-4.0-gemfiles/rack_2_2.gemfile - 26370276319.16 24 May 2026 07:13PM UTC 163
95.39
GitHub Action Run
17 run-4.0-gemfiles/multi_xml.gemfile - 26370276319.17 24 May 2026 07:13PM UTC 163
36.9
GitHub Action Run
18 run-4.0-gemfiles/hashie.gemfile - 26370276319.18 24 May 2026 07:12PM UTC 163
62.26
GitHub Action Run
19 run-3.3-gemfiles/rails_8_1.gemfile - 26370276319.19 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
20 run-3.2-Gemfile - 26370276319.20 24 May 2026 07:13PM UTC 163
95.48
GitHub Action Run
21 run-3.3-gemfiles/rack_3_2.gemfile - 26370276319.21 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
22 run-3.2-gemfiles/rails_7_2.gemfile - 26370276319.22 24 May 2026 07:13PM UTC 164
95.48
GitHub Action Run
23 run-3.4-gemfiles/rack_3_1.gemfile - 26370276319.23 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
24 run-4.0-gemfiles/rails_7_2.gemfile - 26370276319.24 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
25 run-3.2-gemfiles/rack_2_2.gemfile - 26370276319.25 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
26 run-4.0-gemfiles/rack_3_0.gemfile - 26370276319.26 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
27 run-3.2-gemfiles/rails_8_1.gemfile - 26370276319.27 24 May 2026 07:13PM UTC 164
95.48
GitHub Action Run
28 run-4.0-gemfiles/multi_json.gemfile - 26370276319.28 24 May 2026 07:12PM UTC 163
36.9
GitHub Action Run
29 run-4.0-Gemfile - 26370276319.29 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
30 run-3.4-gemfiles/rails_8_1.gemfile - 26370276319.30 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
31 run-3.3-gemfiles/rack_3_1.gemfile - 26370276319.31 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
32 run-4.0-gemfiles/rails_8_1.gemfile - 26370276319.32 24 May 2026 07:13PM UTC 164
95.44
GitHub Action Run
33 run-3.2-gemfiles/rack_3_2.gemfile - 26370276319.33 24 May 2026 07:13PM UTC 163
95.48
GitHub Action Run
34 run-3.3-gemfiles/rack_3_0.gemfile - 26370276319.34 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
35 run-4.0-gemfiles/dry_validation.gemfile - 26370276319.35 24 May 2026 07:12PM UTC 163
58.05
GitHub Action Run
36 run-3.3-Gemfile - 26370276319.36 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
37 run-3.4-gemfiles/rack_3_0.gemfile - 26370276319.37 24 May 2026 07:13PM UTC 163
95.43
GitHub Action Run
38 run-3.3-gemfiles/rack_2_2.gemfile - 26370276319.38 24 May 2026 07:13PM UTC 163
95.39
GitHub Action Run
Source Files on build 26370276319
  • Tree
  • List 164
  • Changed 10
  • Source Changed 10
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #26370276319
  • Pull Request #2718
  • PR Base - master (#26292056269)
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