dry-validation 0.11.2 → 0.12.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/.travis.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +7 -5
- data/README.md +4 -2
- data/Rakefile +5 -3
- data/benchmarks/benchmark_form_invalid.rb +2 -2
- data/benchmarks/benchmark_form_valid.rb +2 -2
- data/dry-validation.gemspec +2 -2
- data/examples/{form.rb → params.rb} +1 -1
- data/lib/dry/validation.rb +3 -3
- data/lib/dry/validation/{input_processor_compiler → compat}/form.rb +20 -2
- data/lib/dry/validation/extensions/monads.rb +6 -5
- data/lib/dry/validation/input_processor_compiler.rb +2 -1
- data/lib/dry/validation/input_processor_compiler/params.rb +49 -0
- data/lib/dry/validation/message_compiler.rb +4 -0
- data/lib/dry/validation/messages/abstract.rb +1 -1
- data/lib/dry/validation/predicate_registry.rb +12 -11
- data/lib/dry/validation/schema/class_interface.rb +7 -4
- data/lib/dry/validation/schema/form.rb +3 -15
- data/lib/dry/validation/schema/params.rb +22 -0
- data/lib/dry/validation/version.rb +1 -1
- data/spec/extensions/monads/result_spec.rb +15 -13
- data/spec/integration/messages/i18n_spec.rb +0 -2
- data/spec/integration/{form → params}/predicates/array_spec.rb +5 -5
- data/spec/integration/{form → params}/predicates/empty_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/eql_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/even_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/excluded_from_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/excludes_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/false_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/filled_spec.rb +10 -10
- data/spec/integration/{form → params}/predicates/format_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/gt_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/gteq_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/included_in_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/includes_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/key_spec.rb +5 -5
- data/spec/integration/{form → params}/predicates/lt_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/lteq_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/max_size_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/min_size_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/none_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/not_eql_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/odd_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/size/fixed_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/size/range_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/true_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/type_spec.rb +8 -8
- data/spec/integration/schema/array_schema_spec.rb +3 -3
- data/spec/integration/schema/extending_dsl_spec.rb +2 -2
- data/spec/integration/schema/form_spec.rb +3 -1
- data/spec/integration/schema/hash_schema_spec.rb +3 -3
- data/spec/integration/schema/json/explicit_types_spec.rb +1 -1
- data/spec/integration/schema/macros/each_spec.rb +1 -1
- data/spec/integration/schema/{form → params}/defining_base_schema_spec.rb +1 -1
- data/spec/integration/schema/{form → params}/explicit_types_spec.rb +35 -22
- data/spec/integration/schema/params_spec.rb +234 -0
- data/spec/integration/schema/reusing_schema_spec.rb +1 -1
- data/spec/integration/schema/using_types_spec.rb +1 -1
- data/spec/integration/schema_spec.rb +5 -5
- data/spec/spec_helper.rb +5 -2
- data/spec/unit/input_processor_compiler/{form_spec.rb → params_spec.rb} +13 -13
- metadata +77 -67
@@ -0,0 +1,234 @@
|
|
1
|
+
RSpec.describe Dry::Validation::Schema::Params, 'defining a schema' do
|
2
|
+
subject(:schema) do
|
3
|
+
Dry::Validation.Params do
|
4
|
+
configure do
|
5
|
+
def email?(value)
|
6
|
+
true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
required(:email).filled
|
11
|
+
|
12
|
+
required(:age).maybe(:int?, gt?: 18)
|
13
|
+
|
14
|
+
required(:address).schema do
|
15
|
+
required(:city).filled
|
16
|
+
required(:street).filled
|
17
|
+
|
18
|
+
required(:loc).schema do
|
19
|
+
required(:lat).filled(:float?)
|
20
|
+
required(:lng).filled(:float?)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
optional(:password).maybe.confirmation
|
25
|
+
|
26
|
+
optional(:phone_number).maybe(:int?, gt?: 0)
|
27
|
+
|
28
|
+
rule(:email_valid) { value(:email).email? }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#messages' do
|
33
|
+
it 'returns compiled error messages' do
|
34
|
+
result = schema.('email' => '', 'age' => '19')
|
35
|
+
|
36
|
+
expect(result.messages).to eql(
|
37
|
+
email: ['must be filled'],
|
38
|
+
address: ['is missing']
|
39
|
+
)
|
40
|
+
|
41
|
+
expect(result.output).to eql(email: '', age: 19)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'returns hints for nested data' do
|
45
|
+
result = schema.(
|
46
|
+
'email' => 'jane@doe.org',
|
47
|
+
'age' => '19',
|
48
|
+
'address' => {
|
49
|
+
'city' => '',
|
50
|
+
'street' => 'Street 1/2',
|
51
|
+
'loc' => { 'lat' => '123.456', 'lng' => '' }
|
52
|
+
}
|
53
|
+
)
|
54
|
+
|
55
|
+
expect(result.messages).to eql(
|
56
|
+
address: {
|
57
|
+
loc: { lng: ['must be filled'] },
|
58
|
+
city: ['must be filled']
|
59
|
+
}
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '#call' do
|
65
|
+
it 'passes when attributes are valid' do
|
66
|
+
result = schema.(
|
67
|
+
'email' => 'jane@doe.org',
|
68
|
+
'age' => '19',
|
69
|
+
'address' => {
|
70
|
+
'city' => 'NYC',
|
71
|
+
'street' => 'Street 1/2',
|
72
|
+
'loc' => { 'lat' => '123.456', 'lng' => '456.123' }
|
73
|
+
}
|
74
|
+
)
|
75
|
+
|
76
|
+
expect(result).to be_success
|
77
|
+
|
78
|
+
expect(result.output).to eql(
|
79
|
+
email: 'jane@doe.org', age: 19,
|
80
|
+
address: {
|
81
|
+
city: 'NYC', street: 'Street 1/2',
|
82
|
+
loc: { lat: 123.456, lng: 456.123 }
|
83
|
+
}
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'validates presence of an email and min age value' do
|
88
|
+
result = schema.('email' => '', 'age' => '18')
|
89
|
+
|
90
|
+
expect(result.messages).to eql(
|
91
|
+
address: ['is missing'],
|
92
|
+
age: ['must be greater than 18'],
|
93
|
+
email: ['must be filled']
|
94
|
+
)
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'handles optionals' do
|
98
|
+
result = schema.(
|
99
|
+
'email' => 'jane@doe.org',
|
100
|
+
'age' => '19',
|
101
|
+
'phone_number' => '12',
|
102
|
+
'address' => {
|
103
|
+
'city' => 'NYC',
|
104
|
+
'street' => 'Street 1/2',
|
105
|
+
'loc' => { 'lat' => '123.456', 'lng' => '456.123' }
|
106
|
+
}
|
107
|
+
)
|
108
|
+
|
109
|
+
expect(result).to be_success
|
110
|
+
|
111
|
+
expect(result.output).to eql(
|
112
|
+
email: 'jane@doe.org', age: 19, phone_number: 12,
|
113
|
+
address: {
|
114
|
+
city: 'NYC', street: 'Street 1/2',
|
115
|
+
loc: { lat: 123.456, lng: 456.123 }
|
116
|
+
}
|
117
|
+
)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe 'with an each and nested schema' do
|
122
|
+
subject(:schema) do
|
123
|
+
Dry::Validation.Params do
|
124
|
+
required(:items).each do
|
125
|
+
schema do
|
126
|
+
required(:title).filled(:str?)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'passes when each element passes schema check' do
|
133
|
+
expect(schema.(items: [{ title: 'Foo' }])).to be_success
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'fails when one or more elements did not pass schema check' do
|
137
|
+
expect(schema.(items: [{ title: 'Foo' }, { title: :Foo }]).messages).to eql(
|
138
|
+
items: { 1 => { title: ['must be a string'] } }
|
139
|
+
)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe 'symbolizing keys when coercion fails' do
|
144
|
+
subject(:schema) do
|
145
|
+
Dry::Validation.Params do
|
146
|
+
required(:email).value(size?: 8..60)
|
147
|
+
required(:birthdate).value(:date?)
|
148
|
+
required(:age).value(:int?, gt?: 23)
|
149
|
+
required(:tags).maybe(max_size?: 3)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
let(:tags) { %(al b c) }
|
154
|
+
|
155
|
+
it 'symbolizes keys and coerces values' do
|
156
|
+
result = schema.(
|
157
|
+
'email' => 'jane@doe.org',
|
158
|
+
'birthdate' => '2001-02-03',
|
159
|
+
'age' => '24',
|
160
|
+
'tags' => tags
|
161
|
+
).to_h
|
162
|
+
|
163
|
+
expect(result.to_h).to eql(
|
164
|
+
email: 'jane@doe.org',
|
165
|
+
birthdate: Date.new(2001, 2, 3),
|
166
|
+
age: 24,
|
167
|
+
tags: tags
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'symbolizes keys even when coercion fails' do
|
172
|
+
result = schema.(
|
173
|
+
'email' => 'jane@doe.org',
|
174
|
+
'birthdate' => '2001-sutin-03',
|
175
|
+
'age' => ['oops'],
|
176
|
+
'tags' => nil
|
177
|
+
)
|
178
|
+
|
179
|
+
expect(result.to_h).to eql(
|
180
|
+
email: 'jane@doe.org',
|
181
|
+
birthdate: '2001-sutin-03',
|
182
|
+
age: ['oops'],
|
183
|
+
tags: nil
|
184
|
+
)
|
185
|
+
|
186
|
+
expect(result.messages).to eql(
|
187
|
+
birthdate: ['must be a date'],
|
188
|
+
age: ['must be an integer', 'must be greater than 23']
|
189
|
+
)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
describe 'with nested schema in a high-level rule' do
|
194
|
+
subject(:schema) do
|
195
|
+
Dry::Validation.Params do
|
196
|
+
required(:address).maybe(:hash?)
|
197
|
+
|
198
|
+
required(:delivery).filled(:bool?)
|
199
|
+
|
200
|
+
rule(address: [:delivery, :address]) do |delivery, address|
|
201
|
+
delivery.true?.then(address.schema(AddressSchema))
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
before do
|
207
|
+
AddressSchema = Dry::Validation.Params do
|
208
|
+
required(:city).filled
|
209
|
+
required(:zipcode).filled(:int?)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
after do
|
214
|
+
Object.send(:remove_const, :AddressSchema)
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'succeeds when nested params schema succeeds' do
|
218
|
+
result = schema.(delivery: '1', address: { city: 'NYC', zipcode: '123' })
|
219
|
+
expect(result).to be_success
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'does not apply schema when there is no match' do
|
223
|
+
result = schema.(delivery: '0', address: nil)
|
224
|
+
expect(result).to be_success
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'fails when nested schema fails' do
|
228
|
+
result = schema.(delivery: '1', address: { city: 'NYC', zipcode: 'foo' })
|
229
|
+
expect(result.messages).to eql(
|
230
|
+
address: { zipcode: ['must be an integer'] }
|
231
|
+
)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -9,7 +9,7 @@ RSpec.describe 'Reusing schemas' do
|
|
9
9
|
|
10
10
|
before do
|
11
11
|
LocationSchema = Dry::Validation.Schema do
|
12
|
-
configure { config.input_processor = :
|
12
|
+
configure { config.input_processor = :params }
|
13
13
|
|
14
14
|
required(:lat).filled(:float?)
|
15
15
|
required(:lng).filled(:float?)
|
@@ -67,7 +67,7 @@ RSpec.describe Dry::Validation::Schema, 'defining schema using dry types' do
|
|
67
67
|
|
68
68
|
context 'custom types' do
|
69
69
|
subject(:schema) do
|
70
|
-
Dry::Validation.
|
70
|
+
Dry::Validation.Params do
|
71
71
|
required(:quantity).filled(Dry::Types['strict.int'].constrained(gt: 1))
|
72
72
|
required(:percentage).filled(Dry::Types['strict.decimal'].constrained(gt: 0, lt: 1))
|
73
73
|
required(:switch).filled(Dry::Types['strict.bool'])
|
@@ -3,12 +3,12 @@ RSpec.describe Dry::Validation::Schema, 'defining key-based schema' do
|
|
3
3
|
subject(:schema) do
|
4
4
|
Dry::Validation.Schema do
|
5
5
|
configure do
|
6
|
-
config.input_processor = :
|
6
|
+
config.input_processor = :params
|
7
7
|
config.type_specs = true
|
8
8
|
end
|
9
9
|
|
10
10
|
required(:email, :string).filled
|
11
|
-
required(:age, [:nil, :
|
11
|
+
required(:age, [:nil, :integer]) { none? | (int? & gt?(18)) }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -34,7 +34,7 @@ RSpec.describe Dry::Validation::Schema, 'defining key-based schema' do
|
|
34
34
|
describe '#type_map' do
|
35
35
|
it 'returns key=>type map' do
|
36
36
|
expect(schema.type_map).to eql(
|
37
|
-
email: Types::String, age: Types::
|
37
|
+
email: Types::String, age: Types::Params::Nil | Types::Params::Integer
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
@@ -48,7 +48,7 @@ RSpec.describe Dry::Validation::Schema, 'defining key-based schema' do
|
|
48
48
|
|
49
49
|
describe 'with nested structures' do
|
50
50
|
subject(:schema) do
|
51
|
-
class CountrySchema
|
51
|
+
class Test::CountrySchema
|
52
52
|
def self.schema
|
53
53
|
Dry::Validation.Schema do
|
54
54
|
required(:name).filled
|
@@ -67,7 +67,7 @@ RSpec.describe Dry::Validation::Schema, 'defining key-based schema' do
|
|
67
67
|
|
68
68
|
required(:street).filled
|
69
69
|
|
70
|
-
required(:country).schema(CountrySchema)
|
70
|
+
required(:country).schema(Test::CountrySchema)
|
71
71
|
end
|
72
72
|
|
73
73
|
required(:phone_numbers).each(:str?)
|
data/spec/spec_helper.rb
CHANGED
@@ -6,8 +6,10 @@ if ENV['COVERAGE'] == 'true' && RUBY_ENGINE == 'ruby' && RUBY_VERSION == '2.3.1'
|
|
6
6
|
end
|
7
7
|
|
8
8
|
begin
|
9
|
-
require '
|
10
|
-
|
9
|
+
require 'pry'
|
10
|
+
require 'pry-byebug'
|
11
|
+
rescue LoadError
|
12
|
+
end
|
11
13
|
|
12
14
|
require 'dry-validation'
|
13
15
|
require 'dry/core/constants'
|
@@ -30,6 +32,7 @@ end
|
|
30
32
|
|
31
33
|
RSpec.configure do |config|
|
32
34
|
config.disable_monkey_patching!
|
35
|
+
config.warnings = true
|
33
36
|
|
34
37
|
config.after do
|
35
38
|
if defined?(I18n)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
RSpec.describe Dry::Validation::InputProcessorCompiler::
|
2
|
-
subject(:compiler) { Dry::Validation::InputProcessorCompiler::
|
1
|
+
RSpec.describe Dry::Validation::InputProcessorCompiler::Params, '#call' do
|
2
|
+
subject(:compiler) { Dry::Validation::InputProcessorCompiler::Params.new }
|
3
3
|
|
4
4
|
include_context 'predicate helper'
|
5
5
|
|
@@ -53,7 +53,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
53
53
|
expect(result).to eql(email: 'jane@doe.org', age: 20, address: 'City, Street 1/2')
|
54
54
|
end
|
55
55
|
|
56
|
-
it 'supports arbitrary types via type?(const) => "
|
56
|
+
it 'supports arbitrary types via type?(const) => "params.const"' do
|
57
57
|
rule_ast = [
|
58
58
|
[
|
59
59
|
:and,
|
@@ -75,7 +75,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
75
75
|
:and,
|
76
76
|
[
|
77
77
|
[:val, p(:key?, :admin)],
|
78
|
-
[:key, [:admin, p(:type?, '
|
78
|
+
[:key, [:admin, p(:type?, 'Params::Bool')]]
|
79
79
|
]
|
80
80
|
]
|
81
81
|
]
|
@@ -85,7 +85,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
85
85
|
expect(input_type['admin' => '0']).to eql(admin: false)
|
86
86
|
end
|
87
87
|
|
88
|
-
it 'supports int? => "
|
88
|
+
it 'supports int? => "params.integer"' do
|
89
89
|
rule_ast = [
|
90
90
|
[
|
91
91
|
:and,
|
@@ -101,7 +101,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
101
101
|
expect(input_type['age' => '21']).to eql(age: 21)
|
102
102
|
end
|
103
103
|
|
104
|
-
it 'supports none? => "
|
104
|
+
it 'supports none? => "params.integer"' do
|
105
105
|
rule_ast = [
|
106
106
|
[
|
107
107
|
:and,
|
@@ -123,7 +123,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
123
123
|
expect(input_type['age' => '21']).to eql(age: 21)
|
124
124
|
end
|
125
125
|
|
126
|
-
it 'supports float? => "
|
126
|
+
it 'supports float? => "params.float"' do
|
127
127
|
rule_ast = [
|
128
128
|
[
|
129
129
|
:and,
|
@@ -139,7 +139,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
139
139
|
expect(input_type['lat' => '21.12']).to eql(lat: 21.12)
|
140
140
|
end
|
141
141
|
|
142
|
-
it 'supports decimal? => "
|
142
|
+
it 'supports decimal? => "params.decimal"' do
|
143
143
|
rule_ast = [
|
144
144
|
[
|
145
145
|
:and,
|
@@ -155,7 +155,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
155
155
|
expect(input_type['lat' => '21.12']).to eql(lat: 21.12.to_d)
|
156
156
|
end
|
157
157
|
|
158
|
-
it 'supports date? => "
|
158
|
+
it 'supports date? => "params.date"' do
|
159
159
|
rule_ast = [
|
160
160
|
[
|
161
161
|
:and,
|
@@ -171,7 +171,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
171
171
|
expect(input_type['bday' => '2012-01-23']).to eql(bday: Date.new(2012, 1, 23))
|
172
172
|
end
|
173
173
|
|
174
|
-
it 'supports date_time? => "
|
174
|
+
it 'supports date_time? => "params.date_time"' do
|
175
175
|
rule_ast = [
|
176
176
|
[
|
177
177
|
:and,
|
@@ -187,7 +187,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
187
187
|
expect(input_type['bday' => '2012-01-23 11:07']).to eql(bday: DateTime.new(2012, 1, 23, 11, 7))
|
188
188
|
end
|
189
189
|
|
190
|
-
it 'supports time? => "
|
190
|
+
it 'supports time? => "params.time"' do
|
191
191
|
rule_ast = [
|
192
192
|
[
|
193
193
|
:and,
|
@@ -203,7 +203,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
203
203
|
expect(input_type['bday' => '2012-01-23 11:07']).to eql(bday: Time.new(2012, 1, 23, 11, 7))
|
204
204
|
end
|
205
205
|
|
206
|
-
it 'supports time? => "
|
206
|
+
it 'supports time? => "params.time"' do
|
207
207
|
rule_ast = [
|
208
208
|
[
|
209
209
|
:and,
|
@@ -219,7 +219,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
|
|
219
219
|
expect(input_type['bday' => '2012-01-23 11:07']).to eql(bday: Time.new(2012, 1, 23, 11, 7))
|
220
220
|
end
|
221
221
|
|
222
|
-
it 'supports bool? => "
|
222
|
+
it 'supports bool? => "params.bool"' do
|
223
223
|
rule_ast = [
|
224
224
|
[
|
225
225
|
:and,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Holland
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -60,33 +60,39 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.2'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: dry-
|
63
|
+
name: dry-logic
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: '0.4'
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.4.0
|
69
72
|
type: :runtime
|
70
73
|
prerelease: false
|
71
74
|
version_requirements: !ruby/object:Gem::Requirement
|
72
75
|
requirements:
|
73
76
|
- - "~>"
|
74
77
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
78
|
+
version: '0.4'
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.4.0
|
76
82
|
- !ruby/object:Gem::Dependency
|
77
|
-
name: dry-
|
83
|
+
name: dry-types
|
78
84
|
requirement: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
86
|
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
88
|
+
version: 0.13.1
|
83
89
|
type: :runtime
|
84
90
|
prerelease: false
|
85
91
|
version_requirements: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
93
|
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
95
|
+
version: 0.13.1
|
90
96
|
- !ruby/object:Gem::Dependency
|
91
97
|
name: dry-core
|
92
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,20 +186,21 @@ files:
|
|
180
186
|
- dry-validation.gemspec
|
181
187
|
- examples/basic.rb
|
182
188
|
- examples/each.rb
|
183
|
-
- examples/form.rb
|
184
189
|
- examples/json.rb
|
185
190
|
- examples/multiple.rb
|
186
191
|
- examples/nested.rb
|
192
|
+
- examples/params.rb
|
187
193
|
- lib/dry-validation.rb
|
188
194
|
- lib/dry/validation.rb
|
195
|
+
- lib/dry/validation/compat/form.rb
|
189
196
|
- lib/dry/validation/deprecations.rb
|
190
197
|
- lib/dry/validation/executor.rb
|
191
198
|
- lib/dry/validation/extensions.rb
|
192
199
|
- lib/dry/validation/extensions/monads.rb
|
193
200
|
- lib/dry/validation/extensions/struct.rb
|
194
201
|
- lib/dry/validation/input_processor_compiler.rb
|
195
|
-
- lib/dry/validation/input_processor_compiler/form.rb
|
196
202
|
- lib/dry/validation/input_processor_compiler/json.rb
|
203
|
+
- lib/dry/validation/input_processor_compiler/params.rb
|
197
204
|
- lib/dry/validation/input_processor_compiler/sanitizer.rb
|
198
205
|
- lib/dry/validation/message.rb
|
199
206
|
- lib/dry/validation/message_compiler.rb
|
@@ -214,6 +221,7 @@ files:
|
|
214
221
|
- lib/dry/validation/schema/form.rb
|
215
222
|
- lib/dry/validation/schema/json.rb
|
216
223
|
- lib/dry/validation/schema/key.rb
|
224
|
+
- lib/dry/validation/schema/params.rb
|
217
225
|
- lib/dry/validation/schema/rule.rb
|
218
226
|
- lib/dry/validation/schema/value.rb
|
219
227
|
- lib/dry/validation/schema_compiler.rb
|
@@ -226,31 +234,6 @@ files:
|
|
226
234
|
- spec/fixtures/locales/pl.yml
|
227
235
|
- spec/integration/custom_error_messages_spec.rb
|
228
236
|
- spec/integration/custom_predicates_spec.rb
|
229
|
-
- spec/integration/form/predicates/array_spec.rb
|
230
|
-
- spec/integration/form/predicates/empty_spec.rb
|
231
|
-
- spec/integration/form/predicates/eql_spec.rb
|
232
|
-
- spec/integration/form/predicates/even_spec.rb
|
233
|
-
- spec/integration/form/predicates/excluded_from_spec.rb
|
234
|
-
- spec/integration/form/predicates/excludes_spec.rb
|
235
|
-
- spec/integration/form/predicates/false_spec.rb
|
236
|
-
- spec/integration/form/predicates/filled_spec.rb
|
237
|
-
- spec/integration/form/predicates/format_spec.rb
|
238
|
-
- spec/integration/form/predicates/gt_spec.rb
|
239
|
-
- spec/integration/form/predicates/gteq_spec.rb
|
240
|
-
- spec/integration/form/predicates/included_in_spec.rb
|
241
|
-
- spec/integration/form/predicates/includes_spec.rb
|
242
|
-
- spec/integration/form/predicates/key_spec.rb
|
243
|
-
- spec/integration/form/predicates/lt_spec.rb
|
244
|
-
- spec/integration/form/predicates/lteq_spec.rb
|
245
|
-
- spec/integration/form/predicates/max_size_spec.rb
|
246
|
-
- spec/integration/form/predicates/min_size_spec.rb
|
247
|
-
- spec/integration/form/predicates/none_spec.rb
|
248
|
-
- spec/integration/form/predicates/not_eql_spec.rb
|
249
|
-
- spec/integration/form/predicates/odd_spec.rb
|
250
|
-
- spec/integration/form/predicates/size/fixed_spec.rb
|
251
|
-
- spec/integration/form/predicates/size/range_spec.rb
|
252
|
-
- spec/integration/form/predicates/true_spec.rb
|
253
|
-
- spec/integration/form/predicates/type_spec.rb
|
254
237
|
- spec/integration/hints_spec.rb
|
255
238
|
- spec/integration/injecting_rules_spec.rb
|
256
239
|
- spec/integration/json/defining_base_schema_spec.rb
|
@@ -258,6 +241,31 @@ files:
|
|
258
241
|
- spec/integration/message_compiler_spec.rb
|
259
242
|
- spec/integration/messages/i18n_spec.rb
|
260
243
|
- spec/integration/optional_keys_spec.rb
|
244
|
+
- spec/integration/params/predicates/array_spec.rb
|
245
|
+
- spec/integration/params/predicates/empty_spec.rb
|
246
|
+
- spec/integration/params/predicates/eql_spec.rb
|
247
|
+
- spec/integration/params/predicates/even_spec.rb
|
248
|
+
- spec/integration/params/predicates/excluded_from_spec.rb
|
249
|
+
- spec/integration/params/predicates/excludes_spec.rb
|
250
|
+
- spec/integration/params/predicates/false_spec.rb
|
251
|
+
- spec/integration/params/predicates/filled_spec.rb
|
252
|
+
- spec/integration/params/predicates/format_spec.rb
|
253
|
+
- spec/integration/params/predicates/gt_spec.rb
|
254
|
+
- spec/integration/params/predicates/gteq_spec.rb
|
255
|
+
- spec/integration/params/predicates/included_in_spec.rb
|
256
|
+
- spec/integration/params/predicates/includes_spec.rb
|
257
|
+
- spec/integration/params/predicates/key_spec.rb
|
258
|
+
- spec/integration/params/predicates/lt_spec.rb
|
259
|
+
- spec/integration/params/predicates/lteq_spec.rb
|
260
|
+
- spec/integration/params/predicates/max_size_spec.rb
|
261
|
+
- spec/integration/params/predicates/min_size_spec.rb
|
262
|
+
- spec/integration/params/predicates/none_spec.rb
|
263
|
+
- spec/integration/params/predicates/not_eql_spec.rb
|
264
|
+
- spec/integration/params/predicates/odd_spec.rb
|
265
|
+
- spec/integration/params/predicates/size/fixed_spec.rb
|
266
|
+
- spec/integration/params/predicates/size/range_spec.rb
|
267
|
+
- spec/integration/params/predicates/true_spec.rb
|
268
|
+
- spec/integration/params/predicates/type_spec.rb
|
261
269
|
- spec/integration/result_spec.rb
|
262
270
|
- spec/integration/schema/array_schema_spec.rb
|
263
271
|
- spec/integration/schema/check_rules_spec.rb
|
@@ -268,8 +276,6 @@ files:
|
|
268
276
|
- spec/integration/schema/dynamic_predicate_args_spec.rb
|
269
277
|
- spec/integration/schema/each_with_set_spec.rb
|
270
278
|
- spec/integration/schema/extending_dsl_spec.rb
|
271
|
-
- spec/integration/schema/form/defining_base_schema_spec.rb
|
272
|
-
- spec/integration/schema/form/explicit_types_spec.rb
|
273
279
|
- spec/integration/schema/form_spec.rb
|
274
280
|
- spec/integration/schema/hash_schema_spec.rb
|
275
281
|
- spec/integration/schema/inheriting_schema_spec.rb
|
@@ -290,6 +296,9 @@ files:
|
|
290
296
|
- spec/integration/schema/numbers_spec.rb
|
291
297
|
- spec/integration/schema/option_with_default_spec.rb
|
292
298
|
- spec/integration/schema/or_spec.rb
|
299
|
+
- spec/integration/schema/params/defining_base_schema_spec.rb
|
300
|
+
- spec/integration/schema/params/explicit_types_spec.rb
|
301
|
+
- spec/integration/schema/params_spec.rb
|
293
302
|
- spec/integration/schema/predicate_verification_spec.rb
|
294
303
|
- spec/integration/schema/predicates/array_spec.rb
|
295
304
|
- spec/integration/schema/predicates/custom_spec.rb
|
@@ -332,8 +341,8 @@ files:
|
|
332
341
|
- spec/support/matchers.rb
|
333
342
|
- spec/support/mutant.rb
|
334
343
|
- spec/support/predicates_integration.rb
|
335
|
-
- spec/unit/input_processor_compiler/form_spec.rb
|
336
344
|
- spec/unit/input_processor_compiler/json_spec.rb
|
345
|
+
- spec/unit/input_processor_compiler/params_spec.rb
|
337
346
|
- spec/unit/message_compiler/visit_failure_spec.rb
|
338
347
|
- spec/unit/message_compiler/visit_spec.rb
|
339
348
|
- spec/unit/message_compiler_spec.rb
|
@@ -362,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
362
371
|
version: '0'
|
363
372
|
requirements: []
|
364
373
|
rubyforge_project:
|
365
|
-
rubygems_version: 2.7.
|
374
|
+
rubygems_version: 2.7.6
|
366
375
|
signing_key:
|
367
376
|
specification_version: 4
|
368
377
|
summary: A simple validation library
|
@@ -373,31 +382,6 @@ test_files:
|
|
373
382
|
- spec/fixtures/locales/pl.yml
|
374
383
|
- spec/integration/custom_error_messages_spec.rb
|
375
384
|
- spec/integration/custom_predicates_spec.rb
|
376
|
-
- spec/integration/form/predicates/array_spec.rb
|
377
|
-
- spec/integration/form/predicates/empty_spec.rb
|
378
|
-
- spec/integration/form/predicates/eql_spec.rb
|
379
|
-
- spec/integration/form/predicates/even_spec.rb
|
380
|
-
- spec/integration/form/predicates/excluded_from_spec.rb
|
381
|
-
- spec/integration/form/predicates/excludes_spec.rb
|
382
|
-
- spec/integration/form/predicates/false_spec.rb
|
383
|
-
- spec/integration/form/predicates/filled_spec.rb
|
384
|
-
- spec/integration/form/predicates/format_spec.rb
|
385
|
-
- spec/integration/form/predicates/gt_spec.rb
|
386
|
-
- spec/integration/form/predicates/gteq_spec.rb
|
387
|
-
- spec/integration/form/predicates/included_in_spec.rb
|
388
|
-
- spec/integration/form/predicates/includes_spec.rb
|
389
|
-
- spec/integration/form/predicates/key_spec.rb
|
390
|
-
- spec/integration/form/predicates/lt_spec.rb
|
391
|
-
- spec/integration/form/predicates/lteq_spec.rb
|
392
|
-
- spec/integration/form/predicates/max_size_spec.rb
|
393
|
-
- spec/integration/form/predicates/min_size_spec.rb
|
394
|
-
- spec/integration/form/predicates/none_spec.rb
|
395
|
-
- spec/integration/form/predicates/not_eql_spec.rb
|
396
|
-
- spec/integration/form/predicates/odd_spec.rb
|
397
|
-
- spec/integration/form/predicates/size/fixed_spec.rb
|
398
|
-
- spec/integration/form/predicates/size/range_spec.rb
|
399
|
-
- spec/integration/form/predicates/true_spec.rb
|
400
|
-
- spec/integration/form/predicates/type_spec.rb
|
401
385
|
- spec/integration/hints_spec.rb
|
402
386
|
- spec/integration/injecting_rules_spec.rb
|
403
387
|
- spec/integration/json/defining_base_schema_spec.rb
|
@@ -405,6 +389,31 @@ test_files:
|
|
405
389
|
- spec/integration/message_compiler_spec.rb
|
406
390
|
- spec/integration/messages/i18n_spec.rb
|
407
391
|
- spec/integration/optional_keys_spec.rb
|
392
|
+
- spec/integration/params/predicates/array_spec.rb
|
393
|
+
- spec/integration/params/predicates/empty_spec.rb
|
394
|
+
- spec/integration/params/predicates/eql_spec.rb
|
395
|
+
- spec/integration/params/predicates/even_spec.rb
|
396
|
+
- spec/integration/params/predicates/excluded_from_spec.rb
|
397
|
+
- spec/integration/params/predicates/excludes_spec.rb
|
398
|
+
- spec/integration/params/predicates/false_spec.rb
|
399
|
+
- spec/integration/params/predicates/filled_spec.rb
|
400
|
+
- spec/integration/params/predicates/format_spec.rb
|
401
|
+
- spec/integration/params/predicates/gt_spec.rb
|
402
|
+
- spec/integration/params/predicates/gteq_spec.rb
|
403
|
+
- spec/integration/params/predicates/included_in_spec.rb
|
404
|
+
- spec/integration/params/predicates/includes_spec.rb
|
405
|
+
- spec/integration/params/predicates/key_spec.rb
|
406
|
+
- spec/integration/params/predicates/lt_spec.rb
|
407
|
+
- spec/integration/params/predicates/lteq_spec.rb
|
408
|
+
- spec/integration/params/predicates/max_size_spec.rb
|
409
|
+
- spec/integration/params/predicates/min_size_spec.rb
|
410
|
+
- spec/integration/params/predicates/none_spec.rb
|
411
|
+
- spec/integration/params/predicates/not_eql_spec.rb
|
412
|
+
- spec/integration/params/predicates/odd_spec.rb
|
413
|
+
- spec/integration/params/predicates/size/fixed_spec.rb
|
414
|
+
- spec/integration/params/predicates/size/range_spec.rb
|
415
|
+
- spec/integration/params/predicates/true_spec.rb
|
416
|
+
- spec/integration/params/predicates/type_spec.rb
|
408
417
|
- spec/integration/result_spec.rb
|
409
418
|
- spec/integration/schema/array_schema_spec.rb
|
410
419
|
- spec/integration/schema/check_rules_spec.rb
|
@@ -415,8 +424,6 @@ test_files:
|
|
415
424
|
- spec/integration/schema/dynamic_predicate_args_spec.rb
|
416
425
|
- spec/integration/schema/each_with_set_spec.rb
|
417
426
|
- spec/integration/schema/extending_dsl_spec.rb
|
418
|
-
- spec/integration/schema/form/defining_base_schema_spec.rb
|
419
|
-
- spec/integration/schema/form/explicit_types_spec.rb
|
420
427
|
- spec/integration/schema/form_spec.rb
|
421
428
|
- spec/integration/schema/hash_schema_spec.rb
|
422
429
|
- spec/integration/schema/inheriting_schema_spec.rb
|
@@ -437,6 +444,9 @@ test_files:
|
|
437
444
|
- spec/integration/schema/numbers_spec.rb
|
438
445
|
- spec/integration/schema/option_with_default_spec.rb
|
439
446
|
- spec/integration/schema/or_spec.rb
|
447
|
+
- spec/integration/schema/params/defining_base_schema_spec.rb
|
448
|
+
- spec/integration/schema/params/explicit_types_spec.rb
|
449
|
+
- spec/integration/schema/params_spec.rb
|
440
450
|
- spec/integration/schema/predicate_verification_spec.rb
|
441
451
|
- spec/integration/schema/predicates/array_spec.rb
|
442
452
|
- spec/integration/schema/predicates/custom_spec.rb
|
@@ -479,8 +489,8 @@ test_files:
|
|
479
489
|
- spec/support/matchers.rb
|
480
490
|
- spec/support/mutant.rb
|
481
491
|
- spec/support/predicates_integration.rb
|
482
|
-
- spec/unit/input_processor_compiler/form_spec.rb
|
483
492
|
- spec/unit/input_processor_compiler/json_spec.rb
|
493
|
+
- spec/unit/input_processor_compiler/params_spec.rb
|
484
494
|
- spec/unit/message_compiler/visit_failure_spec.rb
|
485
495
|
- spec/unit/message_compiler/visit_spec.rb
|
486
496
|
- spec/unit/message_compiler_spec.rb
|