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

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

Build:
Build:
LAST BUILD BRANCH: fix/recompile-settings-mutation-race
DEFAULT BRANCH: master
Ran 08 May 2026 06:05PM UTC
Jobs 37
Files 159
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

08 May 2026 06:02PM UTC coverage: 96.932% (-0.003%) from 96.935%
25571312409

Pull #2702

github

ericproulx
Add oneof: option for polymorphic Hash parameters

Resolves #2385. A Hash parameter can now declare multiple acceptable
shapes:

    params do
      requires :value, type: Hash, oneof: [
        proc { requires :fixed_price, type: Float },
        proc do
          requires :time_unit, type: String
          requires :rate, type: Float
        end
      ]
    end

At request time variants are tried in declaration order against a
deep-dup of the value; the first variant whose validators raise no
exceptions wins, and any coercions it performed are applied to the
parent params.

Each variant block runs in a real `ParamsScope` backed by a small
`OneofCollector` that captures validators locally instead of
registering them on the API. Because variants are evaluated through
the standard scope, the full params DSL is available inside —
`regexp:`, `values:`, `allow_blank:`, nested `Hash`/`Array`, and
so on all work without re-implementation. Variant validators are
themselves real frozen `Validators::Base` instances reused at
request time.

Definition-time guards: `oneof:` requires `type: Hash`, the array
must be non-empty, and every entry must be a `Proc`. Otherwise an
`ArgumentError` is raised at boot.

Adds `Grape::Validations::OneofCollector`,
`Grape::Validations::Validators::OneofValidator`, an `oneof` i18n
key, and `process_oneof!` in `ParamsScope#validates`. README and
CHANGELOG updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2702: Add oneof: option for polymorphic Hash parameters (#2385)

1093 of 1179 branches covered (92.71%)

Branch coverage included in aggregate %.

46 of 47 new or added lines in 3 files covered. (97.87%)

3457 of 3515 relevant lines covered (98.35%)

32100.98 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
93.75
lib/grape/validations/oneof_collector.rb
Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/rack_2_2.gemfile - 25571312409.1 08 May 2026 06:07PM UTC 158
95.58
GitHub Action Run
2 run-3.2-gemfiles/rack_2_2.gemfile - 25571312409.2 08 May 2026 06:05PM UTC 158
95.62
GitHub Action Run
3 run-3.4-gemfiles/rails_8_0.gemfile - 25571312409.3 08 May 2026 06:07PM UTC 159
95.63
GitHub Action Run
4 run-3.3-gemfiles/rack_3_0.gemfile - 25571312409.4 08 May 2026 06:07PM UTC 158
95.62
GitHub Action Run
5 run-4.0-gemfiles/multi_json.gemfile - 25571312409.5 08 May 2026 06:06PM UTC 158
35.67
GitHub Action Run
6 run-3.4-gemfiles/rack_3_2.gemfile - 25571312409.6 08 May 2026 06:05PM UTC 158
95.62
GitHub Action Run
7 run-3.4-gemfiles/rack_2_2.gemfile - 25571312409.7 08 May 2026 06:08PM UTC 158
95.58
GitHub Action Run
8 run-4.0-Gemfile - 25571312409.8 08 May 2026 06:09PM UTC 158
95.62
GitHub Action Run
9 run-4.0-gemfiles/dry_validation.gemfile - 25571312409.9 08 May 2026 06:06PM UTC 158
57.62
GitHub Action Run
10 run-3.2-gemfiles/rails_7_2.gemfile - 25571312409.10 08 May 2026 06:09PM UTC 159
95.67
GitHub Action Run
11 run-3.3-gemfiles/rails_8_0.gemfile - 25571312409.11 08 May 2026 06:05PM UTC 159
95.63
GitHub Action Run
12 run-4.0-gemfiles/rack_3_0.gemfile - 25571312409.12 08 May 2026 06:09PM UTC 158
95.62
GitHub Action Run
13 run-3.2-Gemfile - 25571312409.13 08 May 2026 06:08PM UTC 158
95.67
GitHub Action Run
14 run-3.2-gemfiles/rails_8_0.gemfile - 25571312409.14 08 May 2026 06:05PM UTC 159
95.67
GitHub Action Run
15 run-3.2-gemfiles/rack_3_1.gemfile - 25571312409.15 08 May 2026 06:07PM UTC 158
95.67
GitHub Action Run
16 run-4.0-gemfiles/rails_8_1.gemfile - 25571312409.16 08 May 2026 06:08PM UTC 159
95.63
GitHub Action Run
17 run-3.4-gemfiles/rails_7_2.gemfile - 25571312409.17 08 May 2026 06:08PM UTC 159
95.63
GitHub Action Run
18 run-4.0-gemfiles/rails_7_2.gemfile - 25571312409.18 08 May 2026 06:07PM UTC 159
95.63
GitHub Action Run
19 run-3.3-gemfiles/rails_8_1.gemfile - 25571312409.19 08 May 2026 06:07PM UTC 159
95.63
GitHub Action Run
20 run-4.0-gemfiles/multi_xml.gemfile - 25571312409.20 08 May 2026 06:08PM UTC 158
35.67
GitHub Action Run
21 run-3.3-gemfiles/rails_7_2.gemfile - 25571312409.21 08 May 2026 06:05PM UTC 159
95.63
GitHub Action Run
22 run-3.3-gemfiles/rack_3_2.gemfile - 25571312409.22 08 May 2026 06:07PM UTC 158
95.62
GitHub Action Run
23 run-3.3-Gemfile - 25571312409.23 08 May 2026 06:05PM UTC 158
95.62
GitHub Action Run
24 run-3.4-gemfiles/rack_3_1.gemfile - 25571312409.24 08 May 2026 06:06PM UTC 158
95.62
GitHub Action Run
25 run-4.0-gemfiles/rails_8_0.gemfile - 25571312409.25 08 May 2026 06:08PM UTC 159
95.63
GitHub Action Run
26 run-3.2-gemfiles/rack_3_0.gemfile - 25571312409.26 08 May 2026 06:06PM UTC 158
95.67
GitHub Action Run
27 run-4.0-gemfiles/grape_entity.gemfile - 25571312409.27 08 May 2026 06:07PM UTC 158
49.49
GitHub Action Run
28 run-4.0-gemfiles/hashie.gemfile - 25571312409.28 08 May 2026 06:09PM UTC 158
62.17
GitHub Action Run
29 run-3.3-gemfiles/rack_3_1.gemfile - 25571312409.29 08 May 2026 06:06PM UTC 158
95.62
GitHub Action Run
30 run-3.3-gemfiles/rack_2_2.gemfile - 25571312409.30 08 May 2026 06:08PM UTC 158
95.58
GitHub Action Run
31 run-3.2-gemfiles/rack_3_2.gemfile - 25571312409.31 08 May 2026 06:07PM UTC 158
95.67
GitHub Action Run
32 run-3.4-Gemfile - 25571312409.32 08 May 2026 06:05PM UTC 158
95.62
GitHub Action Run
33 run-3.4-gemfiles/rails_8_1.gemfile - 25571312409.33 08 May 2026 06:06PM UTC 159
95.63
GitHub Action Run
34 run-4.0-gemfiles/rack_3_2.gemfile - 25571312409.34 08 May 2026 06:08PM UTC 158
95.62
GitHub Action Run
35 run-4.0-gemfiles/rack_3_1.gemfile - 25571312409.35 08 May 2026 06:07PM UTC 158
95.62
GitHub Action Run
36 run-3.2-gemfiles/rails_8_1.gemfile - 25571312409.36 08 May 2026 06:07PM UTC 159
95.67
GitHub Action Run
37 run-3.4-gemfiles/rack_3_0.gemfile - 25571312409.37 08 May 2026 06:08PM UTC 158
95.62
GitHub Action Run
Source Files on build 25571312409
  • Tree
  • List 159
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #25571312409
  • Pull Request #2702
  • PR Base - master (#25564552185)
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