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

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

Build:
Build:
LAST BUILD BRANCH: refactor/stateless-attributes-iterator
DEFAULT BRANCH: master
Ran 12 May 2026 06:45AM UTC
Jobs 37
Files 160
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

12 May 2026 06:45AM UTC coverage: 97.012% (-0.004%) from 97.016%
25718219098

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)

1110 of 1195 branches covered (92.89%)

Branch coverage included in aggregate %.

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

3500 of 3557 relevant lines covered (98.4%)

31997.04 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-3.2-gemfiles/rails_7_2.gemfile - 25718219098.1 12 May 2026 06:45AM UTC 160
95.77
GitHub Action Run
2 run-3.4-gemfiles/rack_3_0.gemfile - 25718219098.2 12 May 2026 06:45AM UTC 159
95.72
GitHub Action Run
3 run-3.4-gemfiles/rails_8_0.gemfile - 25718219098.3 12 May 2026 06:45AM UTC 160
95.72
GitHub Action Run
4 run-4.0-gemfiles/rack_3_0.gemfile - 25718219098.4 12 May 2026 06:46AM UTC 159
95.72
GitHub Action Run
5 run-3.2-gemfiles/rack_3_2.gemfile - 25718219098.5 12 May 2026 06:45AM UTC 159
95.76
GitHub Action Run
6 run-3.4-gemfiles/rails_7_2.gemfile - 25718219098.6 12 May 2026 06:46AM UTC 160
95.72
GitHub Action Run
7 run-3.4-Gemfile - 25718219098.7 12 May 2026 06:46AM UTC 159
95.72
GitHub Action Run
8 run-4.0-gemfiles/rack_2_2.gemfile - 25718219098.8 12 May 2026 06:46AM UTC 159
95.68
GitHub Action Run
9 run-4.0-gemfiles/rails_7_2.gemfile - 25718219098.9 12 May 2026 06:46AM UTC 160
95.72
GitHub Action Run
10 run-4.0-gemfiles/grape_entity.gemfile - 25718219098.10 12 May 2026 06:45AM UTC 159
49.56
GitHub Action Run
11 run-3.3-gemfiles/rack_3_1.gemfile - 25718219098.11 12 May 2026 06:46AM UTC 159
95.72
GitHub Action Run
12 run-4.0-gemfiles/rack_3_1.gemfile - 25718219098.12 12 May 2026 06:47AM UTC 159
95.72
GitHub Action Run
13 run-4.0-gemfiles/hashie.gemfile - 25718219098.13 12 May 2026 06:46AM UTC 159
62.1
GitHub Action Run
14 run-3.4-gemfiles/rack_3_2.gemfile - 25718219098.14 12 May 2026 06:46AM UTC 159
95.72
GitHub Action Run
15 run-4.0-gemfiles/rails_8_0.gemfile - 25718219098.15 12 May 2026 06:46AM UTC 160
95.72
GitHub Action Run
16 run-3.3-Gemfile - 25718219098.16 12 May 2026 06:45AM UTC 159
95.72
GitHub Action Run
17 run-4.0-gemfiles/multi_xml.gemfile - 25718219098.17 12 May 2026 06:46AM UTC 159
35.85
GitHub Action Run
18 run-4.0-Gemfile - 25718219098.18 12 May 2026 06:46AM UTC 159
95.72
GitHub Action Run
19 run-3.3-gemfiles/rails_8_1.gemfile - 25718219098.19 12 May 2026 06:46AM UTC 160
95.72
GitHub Action Run
20 run-3.2-Gemfile - 25718219098.20 12 May 2026 06:46AM UTC 159
95.76
GitHub Action Run
21 run-3.4-gemfiles/rack_3_1.gemfile - 25718219098.21 12 May 2026 06:46AM UTC 159
95.72
GitHub Action Run
22 run-4.0-gemfiles/multi_json.gemfile - 25718219098.22 12 May 2026 06:45AM UTC 159
35.85
GitHub Action Run
23 run-3.2-gemfiles/rails_8_1.gemfile - 25718219098.23 12 May 2026 06:45AM UTC 160
95.77
GitHub Action Run
24 run-3.3-gemfiles/rack_3_2.gemfile - 25718219098.24 12 May 2026 06:46AM UTC 159
95.72
GitHub Action Run
25 run-3.2-gemfiles/rack_2_2.gemfile - 25718219098.25 12 May 2026 06:45AM UTC 159
95.72
GitHub Action Run
26 run-3.2-gemfiles/rails_8_0.gemfile - 25718219098.26 12 May 2026 06:45AM UTC 160
95.77
GitHub Action Run
27 run-4.0-gemfiles/dry_validation.gemfile - 25718219098.27 12 May 2026 06:46AM UTC 159
57.61
GitHub Action Run
28 run-3.3-gemfiles/rails_8_0.gemfile - 25718219098.28 12 May 2026 06:46AM UTC 160
95.72
GitHub Action Run
29 run-3.3-gemfiles/rack_2_2.gemfile - 25718219098.29 12 May 2026 06:45AM UTC 159
95.68
GitHub Action Run
30 run-4.0-gemfiles/rails_8_1.gemfile - 25718219098.30 12 May 2026 06:46AM UTC 160
95.72
GitHub Action Run
31 run-3.3-gemfiles/rails_7_2.gemfile - 25718219098.31 12 May 2026 06:45AM UTC 160
95.72
GitHub Action Run
32 run-3.3-gemfiles/rack_3_0.gemfile - 25718219098.32 12 May 2026 06:45AM UTC 159
95.72
GitHub Action Run
33 run-3.4-gemfiles/rack_2_2.gemfile - 25718219098.33 12 May 2026 06:46AM UTC 159
95.68
GitHub Action Run
34 run-3.4-gemfiles/rails_8_1.gemfile - 25718219098.34 12 May 2026 06:45AM UTC 160
95.72
GitHub Action Run
35 run-4.0-gemfiles/rack_3_2.gemfile - 25718219098.35 12 May 2026 06:47AM UTC 159
95.72
GitHub Action Run
36 run-3.2-gemfiles/rack_3_0.gemfile - 25718219098.36 12 May 2026 06:45AM UTC 159
95.76
GitHub Action Run
37 run-3.2-gemfiles/rack_3_1.gemfile - 25718219098.37 12 May 2026 06:45AM UTC 159
95.76
GitHub Action Run
Source Files on build 25718219098
  • Tree
  • List 160
  • 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 #25718219098
  • Pull Request #2702
  • PR Base - master (#25643371840)
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