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

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

Build:
Build:
LAST BUILD BRANCH: fix/adversarial-sweep-2026-08
DEFAULT BRANCH: master
Ran 26 Jul 2026 02:52PM UTC
Jobs 32
Files 169
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

26 Jul 2026 02:52PM UTC coverage: 96.861% (+0.03%) from 96.829%
30206988366

Pull #2822

github

ericproulx
Add a numericality validator

Grape has no built-in way to bound or shape-check a numeric parameter
beyond `values:` (a closed inclusive range or list). Users end up
reaching for a `values:` lambda or a full `contract_scope` schema for
something as simple as "must be a positive integer" or "0..100
inclusive with an exclusive upper bound", both of which are more
ceremony than the check deserves and produce weak error messages.

Add `NumericalityValidator`, registered as `numericality`, following
ActiveModel::Validations::NumericalityValidator's option naming for
familiarity: `greater_than`, `greater_than_or_equal_to`, `less_than`,
`less_than_or_equal_to`, `equal_to`, `other_than`, `only_integer`,
`odd`, `even`. Any combination can be supplied and each has its own
i18n message key (mirroring how `length` has separate `length_min`/
`length_max`/`length_is` keys).

Design notes:
- Non-Numeric values are skipped rather than erroring — numeric-ness
  is `type:`/coercion's job; this validator only owns bounds/parity,
  so it composes with `coerce` instead of duplicating it.
- Applied to a typed array (`type: [Integer]`), every element is
  checked individually (`Array.wrap`), matching how `values` already
  treats arrays — `length` is the one that owns the array's own size.
- `only_integer` accepts whole-numbered `Float`/`BigDecimal` too
  (`val == val.to_i`), not just literal `Integer`.
- Obviously contradictory option combinations (`greater_than` +
  `greater_than_or_equal_to`, `less_than` + `less_than_or_equal_to`,
  `odd` + `even`, `equal_to` + any other comparison, or a reversed
  lower/upper bound) raise `ArgumentError` at definition time, same
  as `length_validator`'s existing `min > max` guard.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Pull Request #2822: Add a numericality validator

1170 of 1264 branches covered (92.56%)

Branch coverage included in aggregate %.

3798 of 3865 relevant lines covered (98.27%)

22764.66 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/dry_validation.gemfile - 30206988366.1 26 Jul 2026 02:53PM UTC 168
58.15
GitHub Action Run
2 run-3.4-Gemfile - 30206988366.2 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
3 run-3.3-gemfiles/rails_7_2.gemfile - 30206988366.3 26 Jul 2026 02:53PM UTC 169
95.45
GitHub Action Run
4 run-4.0-gemfiles/multi_xml.gemfile - 30206988366.4 26 Jul 2026 02:53PM UTC 168
47.28
GitHub Action Run
5 run-3.3-gemfiles/rack_3_0.gemfile - 30206988366.5 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
6 run-4.0-Gemfile - 30206988366.6 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
7 run-4.0-gemfiles/grape_entity.gemfile - 30206988366.7 26 Jul 2026 02:53PM UTC 168
50.54
GitHub Action Run
8 run-4.0-gemfiles/rack_3_1.gemfile - 30206988366.8 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
9 run-4.0-gemfiles/hashie.gemfile - 30206988366.9 26 Jul 2026 02:53PM UTC 168
62.07
GitHub Action Run
10 run-3.4-gemfiles/rack_3_2.gemfile - 30206988366.10 26 Jul 2026 02:52PM UTC 168
95.45
GitHub Action Run
11 run-4.0-gemfiles/rack_3_0.gemfile - 30206988366.11 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
12 run-3.4-gemfiles/rack_3_0.gemfile - 30206988366.12 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
13 run-3.4-gemfiles/rails_8_0.gemfile - 30206988366.13 26 Jul 2026 02:53PM UTC 169
95.46
GitHub Action Run
14 run-3.3-gemfiles/rails_8_0.gemfile - 30206988366.14 26 Jul 2026 02:52PM UTC 169
95.45
GitHub Action Run
15 run-4.0-gemfiles/rails_8_1.gemfile - 30206988366.15 26 Jul 2026 02:53PM UTC 169
95.46
GitHub Action Run
16 run-4.0-gemfiles/grape_swagger.gemfile - 30206988366.16 26 Jul 2026 02:53PM UTC 168
55.16
GitHub Action Run
17 run-3.4-gemfiles/rack_2_2.gemfile - 30206988366.17 26 Jul 2026 02:53PM UTC 168
95.41
GitHub Action Run
18 run-3.4-gemfiles/rails_8_1.gemfile - 30206988366.18 26 Jul 2026 02:54PM UTC 169
95.46
GitHub Action Run
19 run-3.3-gemfiles/rack_2_2.gemfile - 30206988366.19 26 Jul 2026 02:53PM UTC 168
95.41
GitHub Action Run
20 run-3.3-gemfiles/rails_8_1.gemfile - 30206988366.20 26 Jul 2026 02:54PM UTC 169
95.45
GitHub Action Run
21 run-4.0-gemfiles/rack_3_2.gemfile - 30206988366.21 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
22 run-4.0-gemfiles/multi_json_1_20.gemfile - 30206988366.22 26 Jul 2026 02:52PM UTC 168
47.88
GitHub Action Run
23 run-3.3-Gemfile - 30206988366.23 26 Jul 2026 02:52PM UTC 168
95.45
GitHub Action Run
24 run-4.0-gemfiles/multi_xml_0_8.gemfile - 30206988366.24 26 Jul 2026 02:52PM UTC 168
47.32
GitHub Action Run
25 run-4.0-gemfiles/multi_json.gemfile - 30206988366.25 26 Jul 2026 02:53PM UTC 168
47.84
GitHub Action Run
26 run-3.3-gemfiles/rack_3_1.gemfile - 30206988366.26 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
27 run-4.0-gemfiles/rack_2_2.gemfile - 30206988366.27 26 Jul 2026 02:53PM UTC 168
95.41
GitHub Action Run
28 run-4.0-gemfiles/rails_8_0.gemfile - 30206988366.28 26 Jul 2026 02:53PM UTC 169
95.46
GitHub Action Run
29 run-3.4-gemfiles/rack_3_1.gemfile - 30206988366.29 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
30 run-3.3-gemfiles/rack_3_2.gemfile - 30206988366.30 26 Jul 2026 02:53PM UTC 168
95.45
GitHub Action Run
31 run-3.4-gemfiles/rails_7_2.gemfile - 30206988366.31 26 Jul 2026 02:53PM UTC 169
95.46
GitHub Action Run
32 run-4.0-gemfiles/rails_7_2.gemfile - 30206988366.32 26 Jul 2026 02:54PM UTC 169
95.46
GitHub Action Run
Source Files on build 30206988366
  • Tree
  • List 169
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #30206988366
  • Pull Request #2822
  • PR Base - master (#30166451855)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc