sinatra-param-validator 0.16.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -20
- data/.ruby-version +1 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +7 -1
- data/Gemfile.lock +176 -61
- data/README.md +92 -15
- data/Rakefile +3 -3
- data/lib/sinatra/param_validator/camelize.rb +1 -1
- data/lib/sinatra/param_validator/helpers.rb +19 -16
- data/lib/sinatra/param_validator/parameter/array.rb +2 -2
- data/lib/sinatra/param_validator/parameter/boolean.rb +1 -1
- data/lib/sinatra/param_validator/parameter/common.rb +2 -2
- data/lib/sinatra/param_validator/parameter/date.rb +2 -2
- data/lib/sinatra/param_validator/parameter/float.rb +1 -1
- data/lib/sinatra/param_validator/parameter/hash.rb +2 -2
- data/lib/sinatra/param_validator/parameter/integer.rb +1 -1
- data/lib/sinatra/param_validator/parameter/string.rb +1 -1
- data/lib/sinatra/param_validator/parameter/time.rb +2 -2
- data/lib/sinatra/param_validator/parameter.rb +9 -9
- data/lib/sinatra/param_validator/rule/all_or_none_of.rb +2 -2
- data/lib/sinatra/param_validator/rule/any_of.rb +2 -2
- data/lib/sinatra/param_validator/rule/one_of.rb +3 -3
- data/lib/sinatra/param_validator/rule.rb +6 -6
- data/lib/sinatra/param_validator/validator/form.rb +5 -5
- data/lib/sinatra/param_validator/validator.rb +5 -5
- data/lib/sinatra/param_validator/version.rb +1 -1
- data/lib/sinatra/param_validator.rb +13 -13
- data/sinatra-param-validator.gemspec +13 -22
- metadata +5 -121
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4f1bc5e4d1f488a104acd1293e9473c1d942d43ff64da9d33572400fb0b2374
|
4
|
+
data.tar.gz: 320661e0e68e371beecd41c98e4405f654468b75936fd0cca5228c18e3d72d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2b98fcb24054495d43650468c82f95bfa296f59e2f8a72e71ebbef48a6c7c7aa1d82b5973173495c4c9118704df354d4a3844ad53c452b6b6758f609504ba8c
|
7
|
+
data.tar.gz: ac02e5fa56440c297fc9fb41cd1bcb186bf0b472f2bbc7eab49a7f62d803dcdebb44dffad4dd43549f72d4e931536564b9054a84e41c30981e3bccc86ba04991
|
data/.rubocop.yml
CHANGED
@@ -1,23 +1,8 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
inherit_gem:
|
3
|
+
rubocop-rickselby:
|
4
|
+
- config/default.yml
|
5
|
+
- config/rspec.yml
|
6
6
|
|
7
7
|
AllCops:
|
8
|
-
|
9
|
-
NewCops: enable
|
10
|
-
TargetRubyVersion: 2.6
|
11
|
-
|
12
|
-
# Disable block-length check for rspec and gemspec
|
13
|
-
Metrics/BlockLength:
|
14
|
-
Exclude:
|
15
|
-
- 'spec/**/*.rb'
|
16
|
-
- '*.gemspec'
|
17
|
-
|
18
|
-
# Extend permitted line length
|
19
|
-
Layout/LineLength:
|
20
|
-
Max: 120
|
21
|
-
|
22
|
-
RSpec/NestedGroups:
|
23
|
-
Max: 4
|
8
|
+
TargetRubyVersion: 3.2
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.4.3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.18.0] - 2025-04-26
|
4
|
+
|
5
|
+
- Drop support for rubies < 3.2
|
6
|
+
|
7
|
+
## [0.17.0] - 2022-07-19
|
8
|
+
|
9
|
+
- `param` should return the coerced value
|
10
|
+
- Add `transform` to alter a validated parameter
|
11
|
+
|
3
12
|
## [0.16.1] - 2022-07-19
|
4
13
|
|
5
14
|
- Fix URIs in gemspec
|
data/Gemfile
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in sinatra-param_validator-validator.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
gem "rack-test", "~> 2.2"
|
9
|
+
gem "rake", "~> 13.2"
|
10
|
+
gem "rspec", "~> 3.13"
|
11
|
+
gem "rubocop-rickselby", "~> 0.56"
|
12
|
+
gem "sinatra-contrib", "~> 4.1"
|
data/Gemfile.lock
CHANGED
@@ -1,88 +1,203 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sinatra-param-validator (0.
|
4
|
+
sinatra-param-validator (0.18.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
9
|
+
actionview (8.0.2)
|
10
|
+
activesupport (= 8.0.2)
|
11
|
+
builder (~> 3.1)
|
12
|
+
erubi (~> 1.11)
|
13
|
+
rails-dom-testing (~> 2.2)
|
14
|
+
rails-html-sanitizer (~> 1.6)
|
15
|
+
activesupport (8.0.2)
|
16
|
+
base64
|
17
|
+
benchmark (>= 0.3)
|
18
|
+
bigdecimal
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
20
|
+
connection_pool (>= 2.2.5)
|
21
|
+
drb
|
22
|
+
i18n (>= 1.6, < 2)
|
23
|
+
logger (>= 1.4.2)
|
24
|
+
minitest (>= 5.1)
|
25
|
+
securerandom (>= 0.3)
|
26
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
27
|
+
uri (>= 0.13.1)
|
28
|
+
ast (2.4.3)
|
29
|
+
base64 (0.2.0)
|
30
|
+
benchmark (0.4.0)
|
31
|
+
better_html (2.1.1)
|
32
|
+
actionview (>= 6.0)
|
33
|
+
activesupport (>= 6.0)
|
34
|
+
ast (~> 2.0)
|
35
|
+
erubi (~> 1.4)
|
36
|
+
parser (>= 2.4)
|
37
|
+
smart_properties
|
38
|
+
bigdecimal (3.1.9)
|
39
|
+
builder (3.3.0)
|
40
|
+
concurrent-ruby (1.3.5)
|
41
|
+
connection_pool (2.5.2)
|
42
|
+
crass (1.0.6)
|
43
|
+
diff-lcs (1.6.0)
|
44
|
+
drb (2.2.1)
|
45
|
+
erb_lint (0.9.0)
|
46
|
+
activesupport
|
47
|
+
better_html (>= 2.0.1)
|
48
|
+
parser (>= 2.7.1.4)
|
49
|
+
rainbow
|
50
|
+
rubocop (>= 1)
|
51
|
+
smart_properties
|
52
|
+
erubi (1.13.1)
|
53
|
+
i18n (1.14.7)
|
54
|
+
concurrent-ruby (~> 1.0)
|
55
|
+
json (2.11.3)
|
56
|
+
language_server-protocol (3.17.0.4)
|
57
|
+
lint_roller (1.1.0)
|
58
|
+
logger (1.7.0)
|
59
|
+
loofah (2.24.0)
|
60
|
+
crass (~> 1.0.2)
|
61
|
+
nokogiri (>= 1.12.0)
|
62
|
+
minitest (5.25.5)
|
11
63
|
multi_json (1.15.0)
|
12
|
-
mustermann (
|
64
|
+
mustermann (3.0.3)
|
13
65
|
ruby2_keywords (~> 0.0.1)
|
14
|
-
|
15
|
-
|
66
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
67
|
+
racc (~> 1.4)
|
68
|
+
parallel (1.27.0)
|
69
|
+
parser (3.3.8.0)
|
16
70
|
ast (~> 2.4.1)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rack
|
21
|
-
|
71
|
+
racc
|
72
|
+
prism (1.4.0)
|
73
|
+
racc (1.8.1)
|
74
|
+
rack (3.1.13)
|
75
|
+
rack-protection (4.1.1)
|
76
|
+
base64 (>= 0.1.0)
|
77
|
+
logger (>= 1.6.0)
|
78
|
+
rack (>= 3.0.0, < 4)
|
79
|
+
rack-session (2.1.0)
|
80
|
+
base64 (>= 0.1.0)
|
81
|
+
rack (>= 3.0.0)
|
82
|
+
rack-test (2.2.0)
|
83
|
+
rack (>= 1.3)
|
84
|
+
rails-dom-testing (2.2.0)
|
85
|
+
activesupport (>= 5.0.0)
|
86
|
+
minitest
|
87
|
+
nokogiri (>= 1.6)
|
88
|
+
rails-html-sanitizer (1.6.2)
|
89
|
+
loofah (~> 2.21)
|
90
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
22
91
|
rainbow (3.1.1)
|
23
|
-
rake (13.
|
24
|
-
regexp_parser (2.
|
25
|
-
rexml (3.
|
26
|
-
rspec (3.
|
27
|
-
rspec-core (~> 3.
|
28
|
-
rspec-expectations (~> 3.
|
29
|
-
rspec-mocks (~> 3.
|
30
|
-
rspec-core (3.
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-expectations (3.
|
92
|
+
rake (13.2.1)
|
93
|
+
regexp_parser (2.10.0)
|
94
|
+
rexml (3.4.1)
|
95
|
+
rspec (3.13.0)
|
96
|
+
rspec-core (~> 3.13.0)
|
97
|
+
rspec-expectations (~> 3.13.0)
|
98
|
+
rspec-mocks (~> 3.13.0)
|
99
|
+
rspec-core (3.13.3)
|
100
|
+
rspec-support (~> 3.13.0)
|
101
|
+
rspec-expectations (3.13.3)
|
33
102
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-mocks (3.
|
103
|
+
rspec-support (~> 3.13.0)
|
104
|
+
rspec-mocks (3.13.2)
|
36
105
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-support (3.
|
39
|
-
rubocop (1.
|
106
|
+
rspec-support (~> 3.13.0)
|
107
|
+
rspec-support (3.13.2)
|
108
|
+
rubocop (1.75.3)
|
109
|
+
json (~> 2.3)
|
110
|
+
language_server-protocol (~> 3.17.0.2)
|
111
|
+
lint_roller (~> 1.1.0)
|
40
112
|
parallel (~> 1.10)
|
41
|
-
parser (>= 3.
|
113
|
+
parser (>= 3.3.0.2)
|
42
114
|
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
regexp_parser (>=
|
44
|
-
|
45
|
-
rubocop-ast (>= 1.17.0, < 2.0)
|
115
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
116
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
46
117
|
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>=
|
48
|
-
rubocop-ast (1.
|
49
|
-
parser (>= 3.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
rubocop (~> 1.
|
57
|
-
|
118
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
119
|
+
rubocop-ast (1.44.1)
|
120
|
+
parser (>= 3.3.7.2)
|
121
|
+
prism (~> 1.4)
|
122
|
+
rubocop-capybara (2.22.1)
|
123
|
+
lint_roller (~> 1.1)
|
124
|
+
rubocop (~> 1.72, >= 1.72.1)
|
125
|
+
rubocop-factory_bot (2.27.1)
|
126
|
+
lint_roller (~> 1.1)
|
127
|
+
rubocop (~> 1.72, >= 1.72.1)
|
128
|
+
rubocop-performance (1.25.0)
|
129
|
+
lint_roller (~> 1.1)
|
130
|
+
rubocop (>= 1.75.0, < 2.0)
|
131
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
132
|
+
rubocop-rails (2.31.0)
|
133
|
+
activesupport (>= 4.2.0)
|
134
|
+
lint_roller (~> 1.1)
|
135
|
+
rack (>= 1.1)
|
136
|
+
rubocop (>= 1.75.0, < 2.0)
|
137
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
138
|
+
rubocop-rails-accessibility (1.0.1)
|
139
|
+
rubocop (>= 1.0.0)
|
140
|
+
rubocop-rake (0.7.1)
|
141
|
+
lint_roller (~> 1.1)
|
142
|
+
rubocop (>= 1.72.1)
|
143
|
+
rubocop-rickselby (0.56.0)
|
144
|
+
erb_lint (~> 0.9.0)
|
145
|
+
rexml (~> 3.3)
|
146
|
+
rubocop (~> 1.75.0)
|
147
|
+
rubocop-capybara (~> 2.22.0)
|
148
|
+
rubocop-factory_bot (~> 2.27.0)
|
149
|
+
rubocop-performance (~> 1.25.0)
|
150
|
+
rubocop-rails (~> 2.31.0)
|
151
|
+
rubocop-rails-accessibility (~> 1.0.0)
|
152
|
+
rubocop-rake (~> 0.7.0)
|
153
|
+
rubocop-rspec (~> 3.6.0)
|
154
|
+
rubocop-rspec_rails (~> 2.31.0)
|
155
|
+
rubocop-sequel (~> 0.4.0)
|
156
|
+
rubocop-rspec (3.6.0)
|
157
|
+
lint_roller (~> 1.1)
|
158
|
+
rubocop (~> 1.72, >= 1.72.1)
|
159
|
+
rubocop-rspec_rails (2.31.0)
|
160
|
+
lint_roller (~> 1.1)
|
161
|
+
rubocop (~> 1.72, >= 1.72.1)
|
162
|
+
rubocop-rspec (~> 3.5)
|
163
|
+
rubocop-sequel (0.4.1)
|
164
|
+
lint_roller (~> 1.1)
|
165
|
+
rubocop (>= 1.72.1, < 2)
|
166
|
+
ruby-progressbar (1.13.0)
|
58
167
|
ruby2_keywords (0.0.5)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
168
|
+
securerandom (0.4.1)
|
169
|
+
sinatra (4.1.1)
|
170
|
+
logger (>= 1.6.0)
|
171
|
+
mustermann (~> 3.0)
|
172
|
+
rack (>= 3.0.0, < 4)
|
173
|
+
rack-protection (= 4.1.1)
|
174
|
+
rack-session (>= 2.0.0, < 3)
|
63
175
|
tilt (~> 2.0)
|
64
|
-
sinatra-contrib (
|
65
|
-
multi_json
|
66
|
-
mustermann (~>
|
67
|
-
rack-protection (=
|
68
|
-
sinatra (=
|
176
|
+
sinatra-contrib (4.1.1)
|
177
|
+
multi_json (>= 0.0.2)
|
178
|
+
mustermann (~> 3.0)
|
179
|
+
rack-protection (= 4.1.1)
|
180
|
+
sinatra (= 4.1.1)
|
69
181
|
tilt (~> 2.0)
|
70
|
-
|
71
|
-
|
182
|
+
smart_properties (1.17.0)
|
183
|
+
tilt (2.6.0)
|
184
|
+
tzinfo (2.0.6)
|
185
|
+
concurrent-ruby (~> 1.0)
|
186
|
+
unicode-display_width (3.1.4)
|
187
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
188
|
+
unicode-emoji (4.0.4)
|
189
|
+
uri (1.0.3)
|
72
190
|
|
73
191
|
PLATFORMS
|
74
192
|
x86_64-linux
|
75
193
|
|
76
194
|
DEPENDENCIES
|
77
|
-
rack-test (~>
|
78
|
-
rake (~> 13.
|
79
|
-
rspec (~> 3.
|
80
|
-
rubocop (~>
|
81
|
-
|
82
|
-
rubocop-rake (~> 0.5)
|
83
|
-
rubocop-rspec (~> 2.0)
|
84
|
-
sinatra-contrib (~> 2.0)
|
195
|
+
rack-test (~> 2.2)
|
196
|
+
rake (~> 13.2)
|
197
|
+
rspec (~> 3.13)
|
198
|
+
rubocop-rickselby (~> 0.56)
|
199
|
+
sinatra-contrib (~> 4.1)
|
85
200
|
sinatra-param-validator!
|
86
201
|
|
87
202
|
BUNDLED WITH
|
88
|
-
2.
|
203
|
+
2.6.8
|
data/README.md
CHANGED
@@ -76,6 +76,9 @@ All parameters have the following validations available:
|
|
76
76
|
* If this is set, all other validations are skipped if the value is nil
|
77
77
|
* `required`
|
78
78
|
* The parameter must be present and cannot be nil
|
79
|
+
* `transform`
|
80
|
+
* Run a method against the validated parameter, allowing it to be changed
|
81
|
+
* Anything that responds to `to_proc` will work; procs, lambdas, symbols...
|
79
82
|
* `in`
|
80
83
|
* The value is in the given array / range
|
81
84
|
* `is`
|
@@ -89,6 +92,41 @@ All parameters have the following validations available:
|
|
89
92
|
|
90
93
|
* `min` / `max`
|
91
94
|
|
95
|
+
### Running as a helper
|
96
|
+
|
97
|
+
`param` is available as a helper in routes, and will raise `Sinatra::ParamValidator::InvalidParameterError` if validation fails.
|
98
|
+
It will return the parsed parameter, after coercion, defaults and transformations have been applied.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
get '/page' do
|
102
|
+
param :a, String
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
## Rules
|
107
|
+
|
108
|
+
Rules work on multiple parameters:
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
rule :all_or_none_of, :a, :b
|
112
|
+
```
|
113
|
+
|
114
|
+
* `all_or_none_of`
|
115
|
+
* `any_of`
|
116
|
+
* At least one of the given fields must be present
|
117
|
+
* `one_of`
|
118
|
+
* Only one of the given fields can be present
|
119
|
+
|
120
|
+
### Running as a helper
|
121
|
+
|
122
|
+
`rule` is available as a helper in routes, and will raise `Sinatra::ParamValidator::InvalidParameterError` if validation fails.
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
get '/page' do
|
126
|
+
rule :any_of, :a, :b
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
92
130
|
## Custom Messages
|
93
131
|
|
94
132
|
It is possible to return a custom error message when a validation fails:
|
@@ -113,6 +151,10 @@ It is possible to run code after a validation succeeds, by passing a block to `p
|
|
113
151
|
param :number, Integer, required: true do
|
114
152
|
# ...
|
115
153
|
end
|
154
|
+
|
155
|
+
rule :any_of, :a, :b do
|
156
|
+
# ...
|
157
|
+
end
|
116
158
|
```
|
117
159
|
|
118
160
|
If you wish to indicate a validation failure within a block, raise `Sinatra::ParameterValidator::InvalidParameterError`
|
@@ -126,20 +168,6 @@ param :number, Integer, required: true do |validator|
|
|
126
168
|
end
|
127
169
|
```
|
128
170
|
|
129
|
-
## Rules
|
130
|
-
|
131
|
-
Rules work on multiple parameters:
|
132
|
-
|
133
|
-
```ruby
|
134
|
-
rule :all_or_none_of, :a, :b
|
135
|
-
```
|
136
|
-
|
137
|
-
* `all_or_none_of`
|
138
|
-
* `any_of`
|
139
|
-
* At least one of the given fields must be present
|
140
|
-
* `one_of`
|
141
|
-
* Only one of the given fields can be present
|
142
|
-
|
143
171
|
## Validator Types
|
144
172
|
|
145
173
|
The default validator will raise `Sinatra::ParamValidator::ValidationFailedError` when validation fails.
|
@@ -149,7 +177,7 @@ There are two other provided validators, that handle failure differently:
|
|
149
177
|
* `url_param`
|
150
178
|
* will `halt 403`
|
151
179
|
* `form`
|
152
|
-
* if [sinatra-flash](https://
|
180
|
+
* if [sinatra-flash](https://rubygems.org/gems/sinatra-flash) is available, it will flash the errors and `redirect back`
|
153
181
|
* will provide a JSON object with errors to an XHR request
|
154
182
|
* will `halt 400`
|
155
183
|
|
@@ -165,6 +193,55 @@ get '/user/:id', validate_url_param: :user_id do
|
|
165
193
|
end
|
166
194
|
```
|
167
195
|
|
196
|
+
### Form Helpers
|
197
|
+
|
198
|
+
There are some general helpers for handling values after validation.
|
199
|
+
These require the [sinatra-flash](https://rubygems.org/gems/sinatra-flash) gem.
|
200
|
+
|
201
|
+
* `form_values(hash)`
|
202
|
+
* Set the values that will be returned by `form_value`.
|
203
|
+
* These will be overridden by any values flashed to the session in the `:params` hash
|
204
|
+
* `form_value(field)`
|
205
|
+
* Get the form value for the given field
|
206
|
+
* `form_error?(field = nil)`
|
207
|
+
* With a field: returns if that field had any validation errors
|
208
|
+
* Without a field: returns if any field had validation errors
|
209
|
+
* `form_errors(field)`
|
210
|
+
* Get the list of validation errors for the given field
|
211
|
+
* `invalid_feedback(field, default = nil)`
|
212
|
+
* Get the invalid feedback (error message) for the given field, defaulting to the default parameter.
|
213
|
+
|
214
|
+
#### Usage
|
215
|
+
|
216
|
+
For a form to edit something, you can define the values that the form should use:
|
217
|
+
|
218
|
+
```ruby
|
219
|
+
get '/edit/:thing' do
|
220
|
+
thing = #...
|
221
|
+
form_values thing
|
222
|
+
end
|
223
|
+
```
|
224
|
+
|
225
|
+
This is an example form input with bootstrap styling:
|
226
|
+
|
227
|
+
```html
|
228
|
+
<form method="post" <%== 'class="was-validated"' if form_error? %>>
|
229
|
+
<div class="mb-3">
|
230
|
+
<label class="form-label" for="name">Name</label>
|
231
|
+
<input type="text" name="name" id="name"
|
232
|
+
class="form-control <%= 'is-invalid' if form_error? :name %>"
|
233
|
+
value="<%= form_value :name %>">
|
234
|
+
<div class="invalid-feedback">
|
235
|
+
<%== invalid_feedback :name, 'Please provide a name.' %>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
</form>
|
239
|
+
```
|
240
|
+
|
241
|
+
When the form is submitted, validation may fail, and the page will redirect back to the edit form.
|
242
|
+
The redirect will flash the submitted parameters.
|
243
|
+
`form_value` will now prefer the flashed parameters over the original values for `thing`.
|
244
|
+
|
168
245
|
## Validators with parameters
|
169
246
|
|
170
247
|
It is possible to define a validator with a parameter.
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require "rubocop/rake_task"
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
@@ -6,34 +6,35 @@ module Sinatra
|
|
6
6
|
module Helpers
|
7
7
|
def filter_params
|
8
8
|
params.each do |(param, value)|
|
9
|
-
params[param] = nil if value ==
|
10
|
-
params[param] = [] if value == [
|
9
|
+
params[param] = nil if value == ""
|
10
|
+
params[param] = [] if value == [""]
|
11
11
|
end
|
12
12
|
rescue StandardError => e
|
13
13
|
raise "Filter params failed: #{e}"
|
14
14
|
end
|
15
15
|
|
16
|
-
def param(key, type, default: nil, message: nil, **args, &block)
|
16
|
+
def param(key, type, default: nil, message: nil, transform: nil, **args, &block) # rubocop:disable Metrics/ParameterLists
|
17
17
|
parameter = Parameter.new(params[key], type, **args)
|
18
|
-
_update_params_hash key, parameter, default
|
19
18
|
if parameter.valid?
|
19
|
+
_update_params_hash key, parameter, default, transform
|
20
20
|
_run_block(key, block) if block
|
21
21
|
else
|
22
22
|
_handle_error key, message || parameter.errors
|
23
23
|
end
|
24
|
+
params[key]
|
24
25
|
rescue NameError
|
25
|
-
raise
|
26
|
+
raise "Invalid parameter type"
|
26
27
|
end
|
27
28
|
|
28
|
-
def rule(name,
|
29
|
-
rule = Rule.new(name, params,
|
29
|
+
def rule(name, *, **, &block)
|
30
|
+
rule = Rule.new(name, params, *, **)
|
30
31
|
if rule.passes?
|
31
32
|
_run_block(:rules, block) if block
|
32
33
|
else
|
33
34
|
_handle_error :rules, rule.errors unless rule.passes?
|
34
35
|
end
|
35
36
|
rescue NameError
|
36
|
-
raise
|
37
|
+
raise "Invalid rule type"
|
37
38
|
end
|
38
39
|
|
39
40
|
def validate(klass, identifier)
|
@@ -51,22 +52,24 @@ module Sinatra
|
|
51
52
|
end
|
52
53
|
|
53
54
|
def _run_block(key, block)
|
54
|
-
args = block.arity == 1 ? [self] : []
|
55
|
+
args = (block.arity == 1) ? [self] : []
|
55
56
|
instance_exec(*args, &block)
|
56
57
|
rescue InvalidParameterError => e
|
57
58
|
_handle_error key, e.message
|
58
59
|
end
|
59
60
|
|
60
|
-
def _update_params_hash(key, parameter, default)
|
61
|
-
if params.key?(key)
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
def _update_params_hash(key, parameter, default, transform)
|
62
|
+
if !params.key?(key) || params[key].nil?
|
63
|
+
_set_param_to_default key, default unless default.nil?
|
64
|
+
else
|
65
|
+
_set_param_to_coerced key, parameter, transform
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
def _set_param_to_coerced(key, parameter)
|
69
|
-
|
69
|
+
def _set_param_to_coerced(key, parameter, transform)
|
70
|
+
return if parameter.coerced.nil?
|
71
|
+
|
72
|
+
params[key] = transform.nil? ? parameter.coerced : transform.to_proc.call(parameter.coerced)
|
70
73
|
end
|
71
74
|
|
72
75
|
def _set_param_to_default(key, default)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "common"
|
4
4
|
|
5
5
|
module Sinatra
|
6
6
|
module ParamValidator
|
@@ -15,7 +15,7 @@ module Sinatra
|
|
15
15
|
def coerce(value)
|
16
16
|
return nil if value.nil?
|
17
17
|
return value if value.is_a? ::Array
|
18
|
-
return value.split(
|
18
|
+
return value.split(",") if value.is_a? ::String
|
19
19
|
|
20
20
|
raise ArgumentError
|
21
21
|
end
|
@@ -27,7 +27,7 @@ module Sinatra
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def validate_options
|
30
|
-
@options.
|
30
|
+
@options.each_key { |key| raise "Unknown option '#{key}' for #{self.class}" unless respond_to? key }
|
31
31
|
end
|
32
32
|
private :validate_options
|
33
33
|
|
@@ -64,7 +64,7 @@ module Sinatra
|
|
64
64
|
private :nil_and_ok?
|
65
65
|
|
66
66
|
def required(enabled)
|
67
|
-
@errors.push
|
67
|
+
@errors.push "Parameter is required" if enabled && @coerced.nil?
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "common"
|
4
4
|
|
5
5
|
module Sinatra
|
6
6
|
module ParamValidator
|
@@ -15,7 +15,7 @@ module Sinatra
|
|
15
15
|
def coerce(value)
|
16
16
|
return nil if value.nil?
|
17
17
|
return value if value.is_a? ::Hash
|
18
|
-
return value.split(
|
18
|
+
return value.split(",").to_h { |s| s.split(":") } if value.is_a? ::String
|
19
19
|
|
20
20
|
raise ArgumentError
|
21
21
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
3
|
+
require_relative "camelize"
|
4
|
+
require_relative "parameter/array"
|
5
|
+
require_relative "parameter/boolean"
|
6
|
+
require_relative "parameter/date"
|
7
|
+
require_relative "parameter/float"
|
8
|
+
require_relative "parameter/hash"
|
9
|
+
require_relative "parameter/integer"
|
10
|
+
require_relative "parameter/string"
|
11
|
+
require_relative "parameter/time"
|
12
12
|
|
13
13
|
module Sinatra
|
14
14
|
module ParamValidator
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "common"
|
4
4
|
|
5
5
|
module Sinatra
|
6
6
|
module ParamValidator
|
@@ -12,7 +12,7 @@ module Sinatra
|
|
12
12
|
def validate
|
13
13
|
return if count.zero? || count == @fields.count
|
14
14
|
|
15
|
-
@errors.push "All or none of [#{@fields.join
|
15
|
+
@errors.push "All or none of [#{@fields.join ", "}] must be provided"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "common"
|
4
4
|
|
5
5
|
module Sinatra
|
6
6
|
module ParamValidator
|
@@ -10,7 +10,7 @@ module Sinatra
|
|
10
10
|
include Common
|
11
11
|
|
12
12
|
def validate
|
13
|
-
@errors.push "One of [#{@fields.join
|
13
|
+
@errors.push "One of [#{@fields.join ", "}] must be provided" if count < 1
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "common"
|
4
4
|
|
5
5
|
module Sinatra
|
6
6
|
module ParamValidator
|
@@ -10,8 +10,8 @@ module Sinatra
|
|
10
10
|
include Common
|
11
11
|
|
12
12
|
def validate
|
13
|
-
@errors.push "Only one of [#{@fields.join
|
14
|
-
@errors.push "One of [#{@fields.join
|
13
|
+
@errors.push "Only one of [#{@fields.join ", "}] is allowed" if count > 1
|
14
|
+
@errors.push "One of [#{@fields.join ", "}] must be provided" if count < 1
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
3
|
+
require_relative "camelize"
|
4
|
+
require_relative "rule/all_or_none_of"
|
5
|
+
require_relative "rule/any_of"
|
6
|
+
require_relative "rule/one_of"
|
7
7
|
|
8
8
|
module Sinatra
|
9
9
|
module ParamValidator
|
@@ -12,10 +12,10 @@ module Sinatra
|
|
12
12
|
class << self
|
13
13
|
include Camelize
|
14
14
|
|
15
|
-
def new(name, params,
|
15
|
+
def new(name, params, *, **)
|
16
16
|
name = camelize(name) if name.is_a? Symbol
|
17
17
|
klass = Object.const_get "Sinatra::ParamValidator::Rule::#{name}"
|
18
|
-
klass.new(params,
|
18
|
+
klass.new(params, *, **)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -28,14 +28,14 @@ module Sinatra
|
|
28
28
|
|
29
29
|
def invalid_feedback(field, default = nil)
|
30
30
|
fields = Array(field)
|
31
|
-
fields.any? { |f| form_error? f } ? fields.map { |f| form_errors f }.flatten.join(
|
31
|
+
(fields.any? { |f| form_error? f }) ? fields.map { |f| form_errors f }.flatten.join("<br />") : default
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def handle_failure(context)
|
36
36
|
case context.request.preferred_type.to_s
|
37
|
-
when
|
38
|
-
when
|
37
|
+
when "application/json" then return json_failure(context)
|
38
|
+
when "text/html"
|
39
39
|
return flash_failure(context) if defined? Sinatra::Flash
|
40
40
|
end
|
41
41
|
|
@@ -44,13 +44,13 @@ module Sinatra
|
|
44
44
|
|
45
45
|
def run(context)
|
46
46
|
@original_params = context.params
|
47
|
-
super
|
47
|
+
super
|
48
48
|
end
|
49
49
|
|
50
50
|
private
|
51
51
|
|
52
52
|
def json_failure(context)
|
53
|
-
context.halt 400, { error:
|
53
|
+
context.halt 400, { error: "Validation failed", fields: @errors }.to_json
|
54
54
|
end
|
55
55
|
|
56
56
|
def flash_failure(context)
|
@@ -15,9 +15,9 @@ module Sinatra
|
|
15
15
|
raise ValidationFailedError, @errors
|
16
16
|
end
|
17
17
|
|
18
|
-
def run(context, *
|
18
|
+
def run(context, *)
|
19
19
|
context.instance_variable_set(:@_validator_errors, {})
|
20
|
-
context.instance_exec(
|
20
|
+
context.instance_exec(*, &@definition)
|
21
21
|
@errors = context.remove_instance_variable(:@_validator_errors)
|
22
22
|
rescue InvalidParameterError => e
|
23
23
|
@errors[:general] = [e.message]
|
@@ -41,6 +41,6 @@ module Sinatra
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
require_relative
|
45
|
-
require_relative
|
46
|
-
require_relative
|
44
|
+
require_relative "validation_failed_error"
|
45
|
+
require_relative "validator/form"
|
46
|
+
require_relative "validator/url_param"
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
3
|
+
require_relative "param_validator/camelize"
|
4
|
+
require_relative "param_validator/definitions"
|
5
|
+
require_relative "param_validator/helpers"
|
6
|
+
require_relative "param_validator/identifier"
|
7
|
+
require_relative "param_validator/invalid_parameter_error"
|
8
|
+
require_relative "param_validator/parameter"
|
9
|
+
require_relative "param_validator/rule"
|
10
|
+
require_relative "param_validator/snake_case"
|
11
|
+
require_relative "param_validator/validator"
|
12
|
+
require_relative "param_validator/version"
|
13
13
|
|
14
14
|
module Sinatra
|
15
15
|
# Module to register in Sinatra app
|
@@ -20,8 +20,8 @@ module Sinatra
|
|
20
20
|
settings.validator_definitions.add(identifier, definition)
|
21
21
|
end
|
22
22
|
|
23
|
-
def vi(identifier, *
|
24
|
-
Identifier.new(identifier, *
|
23
|
+
def vi(identifier, *)
|
24
|
+
Identifier.new(identifier, *)
|
25
25
|
end
|
26
26
|
|
27
27
|
class << self
|
@@ -34,7 +34,7 @@ module Sinatra
|
|
34
34
|
validator_conditional app, :validate, Sinatra::ParamValidator::Validator
|
35
35
|
|
36
36
|
Sinatra::ParamValidator::Validator.validators.each do |validator|
|
37
|
-
validator_conditional app, :"validate_#{snake_case(validator.to_s.split(
|
37
|
+
validator_conditional app, :"validate_#{snake_case(validator.to_s.split("::").last)}", validator
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -1,22 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "lib/sinatra/param_validator/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = "sinatra-param-validator"
|
7
7
|
spec.version = Sinatra::ParamValidator::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ["Rick Selby"]
|
9
|
+
spec.email = ["rick@selby-family.co.uk"]
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.homepage =
|
13
|
-
spec.license =
|
14
|
-
spec.required_ruby_version =
|
11
|
+
spec.summary = "Validation of parameters for Sinatra"
|
12
|
+
spec.homepage = "https://github.com/rickselby/sinatra-param-validator"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = ">= 3.2"
|
15
15
|
|
16
|
-
spec.metadata[
|
17
|
-
spec.metadata[
|
18
|
-
spec.metadata[
|
19
|
-
spec.metadata[
|
16
|
+
spec.metadata["changelog_uri"] = "https://github.com/rickselby/sinatra-para-validator/CHANGELOG.md"
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/rickselby/sinatra-param-validator"
|
19
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -25,14 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
(f == __FILE__) || f.match(%r{\A(?:spec/|\.git|appveyor)})
|
26
26
|
end
|
27
27
|
end
|
28
|
-
spec.require_paths = [
|
29
|
-
|
30
|
-
spec.add_development_dependency 'rack-test', '~> 1.1'
|
31
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
32
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
|
-
spec.add_development_dependency 'rubocop', '~> 1.0'
|
34
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.0'
|
35
|
-
spec.add_development_dependency 'rubocop-rake', '~> 0.5'
|
36
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
37
|
-
spec.add_development_dependency 'sinatra-contrib', '~> 2.0'
|
28
|
+
spec.require_paths = %w[lib]
|
38
29
|
end
|
metadata
CHANGED
@@ -1,128 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-param-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Selby
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rack-test
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.1'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.1'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '13.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '13.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-performance
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop-rake
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.5'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.5'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '2.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '2.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: sinatra-contrib
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '2.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '2.0'
|
125
|
-
description:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies: []
|
126
12
|
email:
|
127
13
|
- rick@selby-family.co.uk
|
128
14
|
executables: []
|
@@ -174,7 +60,6 @@ metadata:
|
|
174
60
|
homepage_uri: https://github.com/rickselby/sinatra-param-validator
|
175
61
|
source_code_uri: https://github.com/rickselby/sinatra-param-validator
|
176
62
|
rubygems_mfa_required: 'true'
|
177
|
-
post_install_message:
|
178
63
|
rdoc_options: []
|
179
64
|
require_paths:
|
180
65
|
- lib
|
@@ -182,15 +67,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
67
|
requirements:
|
183
68
|
- - ">="
|
184
69
|
- !ruby/object:Gem::Version
|
185
|
-
version: 2
|
70
|
+
version: '3.2'
|
186
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
72
|
requirements:
|
188
73
|
- - ">="
|
189
74
|
- !ruby/object:Gem::Version
|
190
75
|
version: '0'
|
191
76
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
193
|
-
signing_key:
|
77
|
+
rubygems_version: 3.6.7
|
194
78
|
specification_version: 4
|
195
79
|
summary: Validation of parameters for Sinatra
|
196
80
|
test_files: []
|