dry-validation 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +10 -0
  4. data/Gemfile +7 -5
  5. data/README.md +4 -2
  6. data/Rakefile +5 -3
  7. data/benchmarks/benchmark_form_invalid.rb +2 -2
  8. data/benchmarks/benchmark_form_valid.rb +2 -2
  9. data/dry-validation.gemspec +2 -2
  10. data/examples/{form.rb → params.rb} +1 -1
  11. data/lib/dry/validation.rb +3 -3
  12. data/lib/dry/validation/{input_processor_compiler → compat}/form.rb +20 -2
  13. data/lib/dry/validation/extensions/monads.rb +6 -5
  14. data/lib/dry/validation/input_processor_compiler.rb +2 -1
  15. data/lib/dry/validation/input_processor_compiler/params.rb +49 -0
  16. data/lib/dry/validation/message_compiler.rb +4 -0
  17. data/lib/dry/validation/messages/abstract.rb +1 -1
  18. data/lib/dry/validation/predicate_registry.rb +12 -11
  19. data/lib/dry/validation/schema/class_interface.rb +7 -4
  20. data/lib/dry/validation/schema/form.rb +3 -15
  21. data/lib/dry/validation/schema/params.rb +22 -0
  22. data/lib/dry/validation/version.rb +1 -1
  23. data/spec/extensions/monads/result_spec.rb +15 -13
  24. data/spec/integration/messages/i18n_spec.rb +0 -2
  25. data/spec/integration/{form → params}/predicates/array_spec.rb +5 -5
  26. data/spec/integration/{form → params}/predicates/empty_spec.rb +8 -8
  27. data/spec/integration/{form → params}/predicates/eql_spec.rb +8 -8
  28. data/spec/integration/{form → params}/predicates/even_spec.rb +8 -8
  29. data/spec/integration/{form → params}/predicates/excluded_from_spec.rb +8 -8
  30. data/spec/integration/{form → params}/predicates/excludes_spec.rb +8 -8
  31. data/spec/integration/{form → params}/predicates/false_spec.rb +8 -8
  32. data/spec/integration/{form → params}/predicates/filled_spec.rb +10 -10
  33. data/spec/integration/{form → params}/predicates/format_spec.rb +8 -8
  34. data/spec/integration/{form → params}/predicates/gt_spec.rb +8 -8
  35. data/spec/integration/{form → params}/predicates/gteq_spec.rb +8 -8
  36. data/spec/integration/{form → params}/predicates/included_in_spec.rb +8 -8
  37. data/spec/integration/{form → params}/predicates/includes_spec.rb +8 -8
  38. data/spec/integration/{form → params}/predicates/key_spec.rb +5 -5
  39. data/spec/integration/{form → params}/predicates/lt_spec.rb +8 -8
  40. data/spec/integration/{form → params}/predicates/lteq_spec.rb +8 -8
  41. data/spec/integration/{form → params}/predicates/max_size_spec.rb +8 -8
  42. data/spec/integration/{form → params}/predicates/min_size_spec.rb +8 -8
  43. data/spec/integration/{form → params}/predicates/none_spec.rb +8 -8
  44. data/spec/integration/{form → params}/predicates/not_eql_spec.rb +8 -8
  45. data/spec/integration/{form → params}/predicates/odd_spec.rb +8 -8
  46. data/spec/integration/{form → params}/predicates/size/fixed_spec.rb +8 -8
  47. data/spec/integration/{form → params}/predicates/size/range_spec.rb +8 -8
  48. data/spec/integration/{form → params}/predicates/true_spec.rb +8 -8
  49. data/spec/integration/{form → params}/predicates/type_spec.rb +8 -8
  50. data/spec/integration/schema/array_schema_spec.rb +3 -3
  51. data/spec/integration/schema/extending_dsl_spec.rb +2 -2
  52. data/spec/integration/schema/form_spec.rb +3 -1
  53. data/spec/integration/schema/hash_schema_spec.rb +3 -3
  54. data/spec/integration/schema/json/explicit_types_spec.rb +1 -1
  55. data/spec/integration/schema/macros/each_spec.rb +1 -1
  56. data/spec/integration/schema/{form → params}/defining_base_schema_spec.rb +1 -1
  57. data/spec/integration/schema/{form → params}/explicit_types_spec.rb +35 -22
  58. data/spec/integration/schema/params_spec.rb +234 -0
  59. data/spec/integration/schema/reusing_schema_spec.rb +1 -1
  60. data/spec/integration/schema/using_types_spec.rb +1 -1
  61. data/spec/integration/schema_spec.rb +5 -5
  62. data/spec/spec_helper.rb +5 -2
  63. data/spec/unit/input_processor_compiler/{form_spec.rb → params_spec.rb} +13 -13
  64. metadata +77 -67
@@ -1,7 +1,7 @@
1
1
  RSpec.describe 'Predicates: Odd' do
2
2
  context 'with required' do
3
3
  subject(:schema) do
4
- Dry::Validation.Form do
4
+ Dry::Validation.Params do
5
5
  required(:foo) { int? & odd? }
6
6
  end
7
7
  end
@@ -57,7 +57,7 @@ RSpec.describe 'Predicates: Odd' do
57
57
 
58
58
  context 'with optional' do
59
59
  subject(:schema) do
60
- Dry::Validation.Form do
60
+ Dry::Validation.Params do
61
61
  optional(:foo) { int? & odd? }
62
62
  end
63
63
  end
@@ -115,7 +115,7 @@ RSpec.describe 'Predicates: Odd' do
115
115
  context 'with required' do
116
116
  context 'with value' do
117
117
  subject(:schema) do
118
- Dry::Validation.Form do
118
+ Dry::Validation.Params do
119
119
  required(:foo).value(:int?, :odd?)
120
120
  end
121
121
  end
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: Odd' do
171
171
 
172
172
  context 'with filled' do
173
173
  subject(:schema) do
174
- Dry::Validation.Form do
174
+ Dry::Validation.Params do
175
175
  required(:foo).filled(:int?, :odd?)
176
176
  end
177
177
  end
@@ -227,7 +227,7 @@ RSpec.describe 'Predicates: Odd' do
227
227
 
228
228
  context 'with maybe' do
229
229
  subject(:schema) do
230
- Dry::Validation.Form do
230
+ Dry::Validation.Params do
231
231
  required(:foo).maybe(:int?, :odd?)
232
232
  end
233
233
  end
@@ -285,7 +285,7 @@ RSpec.describe 'Predicates: Odd' do
285
285
  context 'with optional' do
286
286
  context 'with value' do
287
287
  subject(:schema) do
288
- Dry::Validation.Form do
288
+ Dry::Validation.Params do
289
289
  optional(:foo).value(:int?, :odd?)
290
290
  end
291
291
  end
@@ -341,7 +341,7 @@ RSpec.describe 'Predicates: Odd' do
341
341
 
342
342
  context 'with filled' do
343
343
  subject(:schema) do
344
- Dry::Validation.Form do
344
+ Dry::Validation.Params do
345
345
  optional(:foo).filled(:int?, :odd?)
346
346
  end
347
347
  end
@@ -397,7 +397,7 @@ RSpec.describe 'Predicates: Odd' do
397
397
 
398
398
  context 'with maybe' do
399
399
  subject(:schema) do
400
- Dry::Validation.Form do
400
+ Dry::Validation.Params do
401
401
  optional(:foo).maybe(:int?, :odd?)
402
402
  end
403
403
  end
@@ -2,7 +2,7 @@ RSpec.describe 'Predicates: Size' do
2
2
  context 'Fixed (integer)' do
3
3
  context 'with required' do
4
4
  subject(:schema) do
5
- Dry::Validation.Form do
5
+ Dry::Validation.Params do
6
6
  required(:foo) { size?(3) }
7
7
  end
8
8
  end
@@ -50,7 +50,7 @@ RSpec.describe 'Predicates: Size' do
50
50
 
51
51
  context 'with optional' do
52
52
  subject(:schema) do
53
- Dry::Validation.Form do
53
+ Dry::Validation.Params do
54
54
  optional(:foo) { size?(3) }
55
55
  end
56
56
  end
@@ -100,7 +100,7 @@ RSpec.describe 'Predicates: Size' do
100
100
  context 'with required' do
101
101
  context 'with value' do
102
102
  subject(:schema) do
103
- Dry::Validation.Form do
103
+ Dry::Validation.Params do
104
104
  required(:foo).value(size?: 3)
105
105
  end
106
106
  end
@@ -148,7 +148,7 @@ RSpec.describe 'Predicates: Size' do
148
148
 
149
149
  context 'with filled' do
150
150
  subject(:schema) do
151
- Dry::Validation.Form do
151
+ Dry::Validation.Params do
152
152
  required(:foo).filled(size?: 3)
153
153
  end
154
154
  end
@@ -196,7 +196,7 @@ RSpec.describe 'Predicates: Size' do
196
196
 
197
197
  context 'with maybe' do
198
198
  subject(:schema) do
199
- Dry::Validation.Form do
199
+ Dry::Validation.Params do
200
200
  required(:foo).maybe(size?: 3)
201
201
  end
202
202
  end
@@ -246,7 +246,7 @@ RSpec.describe 'Predicates: Size' do
246
246
  context 'with optional' do
247
247
  context 'with value' do
248
248
  subject(:schema) do
249
- Dry::Validation.Form do
249
+ Dry::Validation.Params do
250
250
  optional(:foo).value(size?: 3)
251
251
  end
252
252
  end
@@ -294,7 +294,7 @@ RSpec.describe 'Predicates: Size' do
294
294
 
295
295
  context 'with filled' do
296
296
  subject(:schema) do
297
- Dry::Validation.Form do
297
+ Dry::Validation.Params do
298
298
  optional(:foo).filled(size?: 3)
299
299
  end
300
300
  end
@@ -342,7 +342,7 @@ RSpec.describe 'Predicates: Size' do
342
342
 
343
343
  context 'with maybe' do
344
344
  subject(:schema) do
345
- Dry::Validation.Form do
345
+ Dry::Validation.Params do
346
346
  optional(:foo).maybe(size?: 3)
347
347
  end
348
348
  end
@@ -2,7 +2,7 @@ RSpec.describe 'Predicates: Size' do
2
2
  context 'Range' do
3
3
  context 'with required' do
4
4
  subject(:schema) do
5
- Dry::Validation.Form do
5
+ Dry::Validation.Params do
6
6
  required(:foo) { size?(2..3) }
7
7
  end
8
8
  end
@@ -51,7 +51,7 @@ RSpec.describe 'Predicates: Size' do
51
51
 
52
52
  context 'with optional' do
53
53
  subject(:schema) do
54
- Dry::Validation.Form do
54
+ Dry::Validation.Params do
55
55
  optional(:foo) { size?(2..3) }
56
56
  end
57
57
  end
@@ -102,7 +102,7 @@ RSpec.describe 'Predicates: Size' do
102
102
  context 'with required' do
103
103
  context 'with value' do
104
104
  subject(:schema) do
105
- Dry::Validation.Form do
105
+ Dry::Validation.Params do
106
106
  required(:foo).value(size?: 2..3)
107
107
  end
108
108
  end
@@ -150,7 +150,7 @@ RSpec.describe 'Predicates: Size' do
150
150
 
151
151
  context 'with filled' do
152
152
  subject(:schema) do
153
- Dry::Validation.Form do
153
+ Dry::Validation.Params do
154
154
  required(:foo).filled(size?: 2..3)
155
155
  end
156
156
  end
@@ -198,7 +198,7 @@ RSpec.describe 'Predicates: Size' do
198
198
 
199
199
  context 'with maybe' do
200
200
  subject(:schema) do
201
- Dry::Validation.Form do
201
+ Dry::Validation.Params do
202
202
  required(:foo).maybe(size?: 2..3)
203
203
  end
204
204
  end
@@ -248,7 +248,7 @@ RSpec.describe 'Predicates: Size' do
248
248
  context 'with optional' do
249
249
  context 'with value' do
250
250
  subject(:schema) do
251
- Dry::Validation.Form do
251
+ Dry::Validation.Params do
252
252
  optional(:foo).value(size?: 2..3)
253
253
  end
254
254
  end
@@ -297,7 +297,7 @@ RSpec.describe 'Predicates: Size' do
297
297
 
298
298
  context 'with filled' do
299
299
  subject(:schema) do
300
- Dry::Validation.Form do
300
+ Dry::Validation.Params do
301
301
  optional(:foo).filled(size?: 2..3)
302
302
  end
303
303
  end
@@ -345,7 +345,7 @@ RSpec.describe 'Predicates: Size' do
345
345
 
346
346
  context 'with maybe' do
347
347
  subject(:schema) do
348
- Dry::Validation.Form do
348
+ Dry::Validation.Params do
349
349
  optional(:foo).maybe(size?: 2..3)
350
350
  end
351
351
  end
@@ -1,7 +1,7 @@
1
1
  RSpec.describe 'Predicates: True' do
2
2
  context 'with key' do
3
3
  subject(:schema) do
4
- Dry::Validation.Form do
4
+ Dry::Validation.Params do
5
5
  required(:foo) { true? }
6
6
  end
7
7
  end
@@ -57,7 +57,7 @@ RSpec.describe 'Predicates: True' do
57
57
 
58
58
  context 'with optional' do
59
59
  subject(:schema) do
60
- Dry::Validation.Form do
60
+ Dry::Validation.Params do
61
61
  optional(:foo) { true? }
62
62
  end
63
63
  end
@@ -115,7 +115,7 @@ RSpec.describe 'Predicates: True' do
115
115
  context 'with required' do
116
116
  context 'with value' do
117
117
  subject(:schema) do
118
- Dry::Validation.Form do
118
+ Dry::Validation.Params do
119
119
  required(:foo).value(:true?)
120
120
  end
121
121
  end
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: True' do
171
171
 
172
172
  context 'with filled' do
173
173
  subject(:schema) do
174
- Dry::Validation.Form do
174
+ Dry::Validation.Params do
175
175
  required(:foo).filled(:true?)
176
176
  end
177
177
  end
@@ -227,7 +227,7 @@ RSpec.describe 'Predicates: True' do
227
227
 
228
228
  context 'with maybe' do
229
229
  subject(:schema) do
230
- Dry::Validation.Form do
230
+ Dry::Validation.Params do
231
231
  required(:foo).maybe(:true?)
232
232
  end
233
233
  end
@@ -285,7 +285,7 @@ RSpec.describe 'Predicates: True' do
285
285
  context 'with optional' do
286
286
  context 'with value' do
287
287
  subject(:schema) do
288
- Dry::Validation.Form do
288
+ Dry::Validation.Params do
289
289
  optional(:foo).value(:true?)
290
290
  end
291
291
  end
@@ -341,7 +341,7 @@ RSpec.describe 'Predicates: True' do
341
341
 
342
342
  context 'with filled' do
343
343
  subject(:schema) do
344
- Dry::Validation.Form do
344
+ Dry::Validation.Params do
345
345
  optional(:foo).filled(:true?)
346
346
  end
347
347
  end
@@ -397,7 +397,7 @@ RSpec.describe 'Predicates: True' do
397
397
 
398
398
  context 'with maybe' do
399
399
  subject(:schema) do
400
- Dry::Validation.Form do
400
+ Dry::Validation.Params do
401
401
  optional(:foo).maybe(:true?)
402
402
  end
403
403
  end
@@ -1,7 +1,7 @@
1
1
  RSpec.describe 'Predicates: Type' do
2
2
  context 'with required' do
3
3
  subject(:schema) do
4
- Dry::Validation.Form do
4
+ Dry::Validation.Params do
5
5
  required(:foo) { type?(Integer) }
6
6
  end
7
7
  end
@@ -49,7 +49,7 @@ RSpec.describe 'Predicates: Type' do
49
49
 
50
50
  context 'with optional' do
51
51
  subject(:schema) do
52
- Dry::Validation.Form do
52
+ Dry::Validation.Params do
53
53
  optional(:foo) { type?(Integer) }
54
54
  end
55
55
  end
@@ -99,7 +99,7 @@ RSpec.describe 'Predicates: Type' do
99
99
  context 'with required' do
100
100
  context 'with value' do
101
101
  subject(:schema) do
102
- Dry::Validation.Form do
102
+ Dry::Validation.Params do
103
103
  required(:foo).value(type?: Integer)
104
104
  end
105
105
  end
@@ -147,7 +147,7 @@ RSpec.describe 'Predicates: Type' do
147
147
 
148
148
  context 'with filled' do
149
149
  subject(:schema) do
150
- Dry::Validation.Form do
150
+ Dry::Validation.Params do
151
151
  required(:foo).filled(type?: Integer)
152
152
  end
153
153
  end
@@ -195,7 +195,7 @@ RSpec.describe 'Predicates: Type' do
195
195
 
196
196
  context 'with maybe' do
197
197
  subject(:schema) do
198
- Dry::Validation.Form do
198
+ Dry::Validation.Params do
199
199
  required(:foo).maybe(type?: Integer)
200
200
  end
201
201
  end
@@ -245,7 +245,7 @@ RSpec.describe 'Predicates: Type' do
245
245
  context 'with optional' do
246
246
  context 'with value' do
247
247
  subject(:schema) do
248
- Dry::Validation.Form do
248
+ Dry::Validation.Params do
249
249
  optional(:foo).value(type?: Integer)
250
250
  end
251
251
  end
@@ -293,7 +293,7 @@ RSpec.describe 'Predicates: Type' do
293
293
 
294
294
  context 'with filled' do
295
295
  subject(:schema) do
296
- Dry::Validation.Form do
296
+ Dry::Validation.Params do
297
297
  optional(:foo).filled(type?: Integer)
298
298
  end
299
299
  end
@@ -341,7 +341,7 @@ RSpec.describe 'Predicates: Type' do
341
341
 
342
342
  context 'with maybe' do
343
343
  subject(:schema) do
344
- Dry::Validation.Form do
344
+ Dry::Validation.Params do
345
345
  optional(:foo).maybe(type?: Integer)
346
346
  end
347
347
  end
@@ -27,13 +27,13 @@ RSpec.describe Dry::Validation::Schema, 'for an array' do
27
27
 
28
28
  context 'with type specs' do
29
29
  subject(:schema) do
30
- Dry::Validation.Form do
30
+ Dry::Validation.Params do
31
31
  configure { config.type_specs = true }
32
32
 
33
33
  each do
34
34
  schema do
35
- required(:prefix, :int).filled
36
- required(:value, :int).filled
35
+ required(:prefix, :integer).filled
36
+ required(:value, :integer).filled
37
37
  end
38
38
  end
39
39
  end
@@ -2,7 +2,7 @@ RSpec.describe 'Extending DSL' do
2
2
  it 'allows configuring custom DSL methods' do
3
3
  dsl_ext = Module.new do
4
4
  def maybe_int(name, *predicates, &block)
5
- required(name, [:nil, :int]).maybe(:int?, *predicates, &block)
5
+ required(name, [:nil, :integer]).maybe(:int?, *predicates, &block)
6
6
  end
7
7
  end
8
8
 
@@ -12,7 +12,7 @@ RSpec.describe 'Extending DSL' do
12
12
 
13
13
  schema = Dry::Validation.Schema do
14
14
  configure do
15
- config.input_processor = :form
15
+ config.input_processor = :params
16
16
  config.type_specs = true
17
17
  end
18
18
 
@@ -1,4 +1,6 @@
1
- RSpec.describe Dry::Validation::Schema::Form, 'defining a schema' do
1
+ RSpec.describe 'Dry::Validation::Schema::Form', 'defining a schema' do
2
+ before(:all) { require 'dry/validation/compat/form' }
3
+
2
4
  subject(:schema) do
3
5
  Dry::Validation.Form do
4
6
  configure do
@@ -22,12 +22,12 @@ RSpec.describe Dry::Validation::Schema, 'for a hash' do
22
22
 
23
23
  context 'with type specs' do
24
24
  subject(:schema) do
25
- Dry::Validation.Form do
25
+ Dry::Validation.Params do
26
26
  configure { config.type_specs = true }
27
27
 
28
28
  hash? do
29
- required(:prefix, :int).filled
30
- required(:value, :int).filled
29
+ required(:prefix, :integer).filled
30
+ required(:value, :integer).filled
31
31
  end
32
32
  end
33
33
  end
@@ -59,7 +59,7 @@ RSpec.describe Dry::Validation::Schema::JSON, 'explicit types' do
59
59
  subject(:schema) do
60
60
  Dry::Validation.JSON do
61
61
  configure { config.type_specs = true }
62
- required(:bdate, Types::Json::Nil | Types::Json::Date)
62
+ required(:bdate, Types::JSON::Nil | Types::JSON::Date)
63
63
  end
64
64
  end
65
65
 
@@ -210,7 +210,7 @@ RSpec.describe 'Macros #each' do
210
210
  context 'with inferred predicates and a form schema' do
211
211
  context "predicate w/o options" do
212
212
  subject(:schema) do
213
- Dry::Validation.Form do
213
+ Dry::Validation.Params do
214
214
  required(:songs).each(:str?)
215
215
  end
216
216
  end
@@ -3,7 +3,7 @@ require 'i18n'
3
3
 
4
4
  RSpec.describe 'Defining base schema class' do
5
5
  subject(:schema) do
6
- Dry::Validation.Form(BaseSchema) do
6
+ Dry::Validation.Params(BaseSchema) do
7
7
  required(:email).filled(:email?)
8
8
  end
9
9
  end
@@ -1,22 +1,35 @@
1
- RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
1
+ RSpec.describe Dry::Validation::Schema::Params, 'explicit types' do
2
2
  context 'single type spec without rules' do
3
3
  subject(:schema) do
4
- Dry::Validation.Form do
4
+ Dry::Validation.Params do
5
5
  configure { config.type_specs = true }
6
- required(:age, :int)
6
+ required(:age, :integer)
7
7
  end
8
8
  end
9
9
 
10
- it 'uses form coercion' do
10
+ it 'uses params coercion' do
11
+ expect(schema.('age' => '19').to_h).to eql(age: 19)
12
+ end
13
+ end
14
+
15
+ context 'integer' do
16
+ subject(:schema) do
17
+ Dry::Validation.Params do
18
+ configure { config.type_specs = true }
19
+ required(:age, :integer)
20
+ end
21
+ end
22
+
23
+ it 'uses params coercion' do
11
24
  expect(schema.('age' => '19').to_h).to eql(age: 19)
12
25
  end
13
26
  end
14
27
 
15
28
  context 'single type spec with rules' do
16
29
  subject(:schema) do
17
- Dry::Validation.Form do
30
+ Dry::Validation.Params do
18
31
  configure { config.type_specs = true }
19
- required(:age, :int).value(:int?, gt?: 18)
32
+ required(:age, :integer).value(:int?, gt?: 18)
20
33
  end
21
34
  end
22
35
 
@@ -28,26 +41,26 @@ RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
28
41
 
29
42
  context 'single type spec with an array' do
30
43
  subject(:schema) do
31
- Dry::Validation.Form do
44
+ Dry::Validation.Params do
32
45
  configure { config.type_specs = true }
33
- required(:nums, [:int])
46
+ required(:nums, [:integer])
34
47
  end
35
48
  end
36
49
 
37
- it 'uses form coercion' do
50
+ it 'uses params coercion' do
38
51
  expect(schema.(nums: %w(1 2 3)).to_h).to eql(nums: [1, 2, 3])
39
52
  end
40
53
  end
41
54
 
42
55
  context 'sum type spec without rules' do
43
56
  subject(:schema) do
44
- Dry::Validation.Form do
57
+ Dry::Validation.Params do
45
58
  configure { config.type_specs = true }
46
- required(:age, [:nil, :int])
59
+ required(:age, [:nil, :integer])
47
60
  end
48
61
  end
49
62
 
50
- it 'uses form coercion' do
63
+ it 'uses params coercion' do
51
64
  expect(schema.('age' => '19').to_h).to eql(age: 19)
52
65
  expect(schema.('age' => '').to_h).to eql(age: nil)
53
66
  end
@@ -55,9 +68,9 @@ RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
55
68
 
56
69
  context 'sum type spec with rules' do
57
70
  subject(:schema) do
58
- Dry::Validation.Form do
71
+ Dry::Validation.Params do
59
72
  configure { config.type_specs = true }
60
- required(:age, [:nil, :int]).maybe(:int?, gt?: 18)
73
+ required(:age, [:nil, :integer]).maybe(:int?, gt?: 18)
61
74
  end
62
75
  end
63
76
 
@@ -70,13 +83,13 @@ RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
70
83
 
71
84
  context 'using a type object' do
72
85
  subject(:schema) do
73
- Dry::Validation.Form do
86
+ Dry::Validation.Params do
74
87
  configure { config.type_specs = true }
75
- required(:age, Types::Form::Nil | Types::Form::Int)
88
+ required(:age, Types::Params::Nil | Types::Params::Integer)
76
89
  end
77
90
  end
78
91
 
79
- it 'uses form coercion' do
92
+ it 'uses params coercion' do
80
93
  expect(schema.('age' => '').to_h).to eql(age: nil)
81
94
  expect(schema.('age' => '19').to_h).to eql(age: 19)
82
95
  end
@@ -84,12 +97,12 @@ RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
84
97
 
85
98
  context 'nested schema' do
86
99
  subject(:schema) do
87
- Dry::Validation.Form do
100
+ Dry::Validation.Params do
88
101
  configure { config.type_specs = true }
89
102
 
90
103
  required(:user).schema do
91
104
  required(:email, :string)
92
- required(:age, :int)
105
+ required(:age, :integer)
93
106
 
94
107
  required(:address).schema do
95
108
  required(:street, :string)
@@ -105,7 +118,7 @@ RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
105
118
  end
106
119
  end
107
120
 
108
- it 'uses form coercion for nested input' do
121
+ it 'uses params coercion for nested input' do
109
122
  input = {
110
123
  'user' => {
111
124
  'email' => 'jane@doe.org',
@@ -136,7 +149,7 @@ RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
136
149
 
137
150
  context 'nested schema with arrays' do
138
151
  subject(:schema) do
139
- Dry::Validation.Form do
152
+ Dry::Validation.Params do
140
153
  configure { config.type_specs = true }
141
154
 
142
155
  required(:song).schema do
@@ -163,7 +176,7 @@ RSpec.describe Dry::Validation::Schema::Form, 'explicit types' do
163
176
  expect(result.to_h).to eql(song: { tags: nil })
164
177
  end
165
178
 
166
- it 'uses form coercion for nested input' do
179
+ it 'uses params coercion for nested input' do
167
180
  input = {
168
181
  'song' => {
169
182
  'title' => 'dry-rb is awesome lala',