dry-validation 0.9.5 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -8
  3. data/CHANGELOG.md +34 -1
  4. data/Gemfile +2 -0
  5. data/Rakefile +12 -3
  6. data/config/errors.yml +1 -0
  7. data/dry-validation.gemspec +3 -2
  8. data/lib/dry/validation/executor.rb +3 -27
  9. data/lib/dry/validation/extensions/monads.rb +17 -0
  10. data/lib/dry/validation/extensions/struct.rb +32 -0
  11. data/lib/dry/validation/extensions.rb +7 -0
  12. data/lib/dry/validation/input_processor_compiler.rb +19 -3
  13. data/lib/dry/validation/message.rb +43 -30
  14. data/lib/dry/validation/message_compiler/visitor_opts.rb +39 -0
  15. data/lib/dry/validation/message_compiler.rb +98 -52
  16. data/lib/dry/validation/message_set.rb +59 -30
  17. data/lib/dry/validation/predicate_registry.rb +17 -6
  18. data/lib/dry/validation/result.rb +39 -17
  19. data/lib/dry/validation/schema/check.rb +5 -4
  20. data/lib/dry/validation/schema/class_interface.rb +6 -13
  21. data/lib/dry/validation/schema/dsl.rb +9 -3
  22. data/lib/dry/validation/schema/form.rb +12 -3
  23. data/lib/dry/validation/schema/json.rb +12 -3
  24. data/lib/dry/validation/schema/key.rb +6 -6
  25. data/lib/dry/validation/schema/rule.rb +14 -8
  26. data/lib/dry/validation/schema/value.rb +23 -21
  27. data/lib/dry/validation/schema.rb +9 -12
  28. data/lib/dry/validation/schema_compiler.rb +16 -2
  29. data/lib/dry/validation/version.rb +1 -1
  30. data/lib/dry/validation.rb +11 -23
  31. data/spec/extensions/monads/result_spec.rb +38 -0
  32. data/spec/extensions/struct/schema_spec.rb +32 -0
  33. data/spec/integration/custom_predicates_spec.rb +7 -6
  34. data/spec/integration/form/predicates/size/fixed_spec.rb +0 -2
  35. data/spec/integration/form/predicates/size/range_spec.rb +0 -2
  36. data/spec/integration/hints_spec.rb +2 -6
  37. data/spec/integration/json/defining_base_schema_spec.rb +41 -0
  38. data/spec/integration/{error_compiler_spec.rb → message_compiler_spec.rb} +79 -131
  39. data/spec/integration/result_spec.rb +26 -4
  40. data/spec/integration/schema/check_with_nested_el_spec.rb +1 -1
  41. data/spec/integration/schema/check_with_nth_el_spec.rb +1 -1
  42. data/spec/integration/schema/defining_base_schema_spec.rb +3 -0
  43. data/spec/integration/schema/dynamic_predicate_args_spec.rb +34 -9
  44. data/spec/integration/schema/form/defining_base_schema_spec.rb +41 -0
  45. data/spec/integration/schema/json_spec.rb +1 -0
  46. data/spec/integration/schema/macros/input_spec.rb +26 -0
  47. data/spec/integration/schema/macros/rule_spec.rb +2 -1
  48. data/spec/integration/schema/macros/value_spec.rb +1 -1
  49. data/spec/integration/schema/macros/when_spec.rb +1 -24
  50. data/spec/integration/schema/or_spec.rb +87 -0
  51. data/spec/integration/schema/predicates/custom_spec.rb +4 -4
  52. data/spec/integration/schema/predicates/even_spec.rb +10 -10
  53. data/spec/integration/schema/predicates/odd_spec.rb +10 -10
  54. data/spec/integration/schema/predicates/size/fixed_spec.rb +0 -3
  55. data/spec/integration/schema/predicates/size/range_spec.rb +0 -2
  56. data/spec/integration/schema/predicates/type_spec.rb +22 -0
  57. data/spec/integration/schema/using_types_spec.rb +14 -41
  58. data/spec/integration/schema/validate_spec.rb +83 -0
  59. data/spec/integration/schema/xor_spec.rb +5 -5
  60. data/spec/integration/schema_builders_spec.rb +4 -2
  61. data/spec/integration/schema_spec.rb +8 -0
  62. data/spec/shared/message_compiler.rb +11 -0
  63. data/spec/shared/predicate_helper.rb +5 -3
  64. data/spec/spec_helper.rb +15 -0
  65. data/spec/unit/input_processor_compiler/form_spec.rb +3 -3
  66. data/spec/unit/message_compiler/visit_failure_spec.rb +38 -0
  67. data/spec/unit/message_compiler/visit_spec.rb +16 -0
  68. data/spec/unit/message_compiler_spec.rb +7 -0
  69. data/spec/unit/predicate_registry_spec.rb +2 -2
  70. data/spec/unit/schema/key_spec.rb +19 -12
  71. data/spec/unit/schema/rule_spec.rb +14 -6
  72. data/spec/unit/schema/value_spec.rb +49 -52
  73. metadata +50 -20
  74. data/lib/dry/validation/constants.rb +0 -6
  75. data/lib/dry/validation/error.rb +0 -26
  76. data/lib/dry/validation/error_compiler.rb +0 -81
  77. data/lib/dry/validation/hint_compiler.rb +0 -104
  78. data/spec/unit/error_compiler_spec.rb +0 -7
  79. data/spec/unit/hint_compiler_spec.rb +0 -51
@@ -7,7 +7,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
7
7
  [
8
8
  [
9
9
  :and, [
10
- [:val, p(:key?, :email)],
10
+ p(:key?, :email),
11
11
  [
12
12
  :and, [
13
13
  [:key, [:email, p(:str?)]],
@@ -18,7 +18,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
18
18
  ],
19
19
  [
20
20
  :and, [
21
- [:val, p(:key?, :age)],
21
+ p(:key?, :age),
22
22
  [
23
23
  :or, [
24
24
  [:key, [:age, p(:none?)]],
@@ -34,7 +34,7 @@ RSpec.describe Dry::Validation::InputProcessorCompiler::Form, '#call' do
34
34
  ],
35
35
  [
36
36
  :and, [
37
- [:val, p(:key?, :address)],
37
+ p(:key?, :address),
38
38
  [:key, [:address, p(:str?)]]
39
39
  ]
40
40
  ]
@@ -0,0 +1,38 @@
1
+ RSpec.describe Dry::Validation::MessageCompiler, '#visit_failure' do
2
+ include_context :message_compiler
3
+
4
+ let(:visitor) { :visit_failure }
5
+
6
+ context 'with :int? predicate' do
7
+ let(:node) do
8
+ [:age, [:key, [:age, [:predicate, [:int?, [[:input, '17']]]]]]]
9
+ end
10
+
11
+ it 'returns a message for :int? failure with :rule name inferred from key-rule' do
12
+ expect(result.rule).to be(:age)
13
+ expect(result.path).to eql([:age])
14
+ expect(result).to eql('must be an integer')
15
+ end
16
+ end
17
+
18
+ context 'with set failure and :int? predicate' do
19
+ let(:node) do
20
+ [:items, [:key, [:items, [:set, [
21
+ [:key, [0, [:predicate, [:int?, [[:input, 'foo']]]]]],
22
+ [:key, [2, [:predicate, [:int?, [[:input, 'bar']]]]]]
23
+ ]]]]]
24
+ end
25
+
26
+ it 'returns a message for the first element that failed' do
27
+ expect(result[0].rule).to be(:items)
28
+ expect(result[0].path).to eql([:items, 0])
29
+ expect(result[0]).to eql('must be an integer')
30
+ end
31
+
32
+ it 'returns a message for the third element that failed' do
33
+ expect(result[1].rule).to be(:items)
34
+ expect(result[1].path).to eql([:items, 2])
35
+ expect(result[1]).to eql('must be an integer')
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,16 @@
1
+ RSpec.describe Dry::Validation::MessageCompiler, '#visit' do
2
+ include_context :message_compiler
3
+
4
+ let(:visitor) { :visit }
5
+
6
+ context 'with an anonymous :failure' do
7
+ let(:node) do
8
+ [:failure, [:age, [:key, [:age, [:predicate, [:int?, [[:input, '17']]]]]]]]
9
+ end
10
+
11
+ it 'returns a message for :int? failure with :rule name inferred from key-rule' do
12
+ expect(result.rule).to be(:age)
13
+ expect(result).to eql('must be an integer')
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ RSpec.describe MessageCompiler, '#call' do
2
+ subject(:message_compiler) { MessageCompiler.new( Messages.default ) }
3
+
4
+ it 'returns an empty hash when there are no errors' do
5
+ expect(message_compiler.([])).to be_empty
6
+ end
7
+ end
@@ -12,7 +12,7 @@ RSpec.describe PredicateRegistry do
12
12
 
13
13
  describe '.[]' do
14
14
  it 'returns a registry which collects predicate methods' do
15
- expect(predicate_registry[:dis_ok?]).to be_instance_of(Dry::Logic::Predicate)
15
+ expect(predicate_registry[:dis_ok?]).to be_instance_of(UnboundMethod)
16
16
  end
17
17
  end
18
18
 
@@ -27,7 +27,7 @@ RSpec.describe PredicateRegistry do
27
27
  registry = predicate_registry.bind(schema)
28
28
 
29
29
  expect(registry).to be_frozen
30
- expect(registry[:dis_ok?]).to be_instance_of(Dry::Logic::Predicate)
30
+ expect(registry[:dis_ok?]).to be_a(Method)
31
31
  expect(registry[:dis_ok?].()).to be(true)
32
32
  end
33
33
  end
@@ -7,7 +7,9 @@ RSpec.describe Schema::Key do
7
7
  subject(:user) { Schema::Key[:user, registry: registry] }
8
8
 
9
9
  it 'returns a key rule' do
10
- expect(user.str?.to_ast).to eql([:key, [:user, p(:str?)]])
10
+ expect(user.str?.to_ast).to eql(
11
+ [:rule, [:user, [:key, [:user, [:predicate, [:str?, [[:input, Undefined]]]]]]]]
12
+ )
11
13
  end
12
14
 
13
15
  it 'returns a key rule & disjunction rule created within the block' do
@@ -15,17 +17,22 @@ RSpec.describe Schema::Key do
15
17
  required(:email) { none? | filled? }
16
18
  end
17
19
 
18
- expect(user.to_ast).to eql([
19
- :key, [:user, [
20
- :and, [
21
- [:val, p(:hash?)],
22
- [:key, [:user, [:and, [
23
- [:val, p(:key?, :email)],
24
- [:or, [[:key, [:email, p(:none?)]], [:key, [:email, p(:filled?)]]]
25
- ]]]]]
26
- ]
27
- ]]
28
- ])
20
+ expect(user.to_ast).to eql(
21
+ [:key, [:user, [:rule, [:user,
22
+ [:and, [
23
+ [:rule, [:user, [:predicate, [:hash?, [[:input, Undefined]]]]]],
24
+ [:rule, [:user, [:key, [:user, [:rule, [:email,
25
+ [:and, [
26
+ [:rule, [:email, [:predicate, [:key?, [[:name, :email], [:input, Undefined]]]]]],
27
+ [:rule, [:user, [:rule, [:email,
28
+ [:or, [
29
+ [:rule, [:email, [:key, [:email, [:predicate, [:none?, [[:input, Undefined]]]]]]]],
30
+ [:rule, [:email, [:key, [:email, [:predicate, [:filled?, [[:input, Undefined]]]]]]]]
31
+ ]]]]]]
32
+ ]]]]]]]
33
+ ]]]
34
+ ]]]]
35
+ )
29
36
  end
30
37
  end
31
38
  end
@@ -1,8 +1,8 @@
1
1
  RSpec.describe Schema::Rule do
2
2
  include_context 'predicate helper'
3
3
 
4
- let(:filled) { [:val, [:email, p(:filled?)]] }
5
- let(:format) { [:val, [:email, p(:format?, /regex/)]] }
4
+ let(:filled) { p(:filled?) }
5
+ let(:format) { p(:format?, /regex/) }
6
6
 
7
7
  let(:left) { Schema::Rule.new(filled, name: :email, target: target) }
8
8
  let(:right) { Schema::Rule.new(format, name: :email, target: target) }
@@ -10,25 +10,33 @@ RSpec.describe Schema::Rule do
10
10
 
11
11
  describe '#and' do
12
12
  it 'returns a conjunction' do
13
- expect(left.and(right).to_ast).to match_array([:and, [filled, format]])
13
+ expect(left.and(right).to_ast).to match_array(
14
+ [:rule, [:email, [:and, [[:rule, [:email, filled]], [:rule, [:email, format]]]]]]
15
+ )
14
16
  end
15
17
  end
16
18
 
17
19
  describe '#or' do
18
20
  it 'returns a disjunction' do
19
- expect(left.or(right).to_ast).to match_array([:or, [filled, format]])
21
+ expect(left.or(right).to_ast).to match_array(
22
+ [:rule, [:email, [:or, [[:rule, [:email, filled]], [:rule, [:email, format]]]]]]
23
+ )
20
24
  end
21
25
  end
22
26
 
23
27
  describe '#xor' do
24
28
  it 'returns an exclusive disjunction' do
25
- expect(left.xor(right).to_ast).to match_array([:xor, [filled, format]])
29
+ expect(left.xor(right).to_ast).to match_array(
30
+ [:rule, [:email, [:xor, [[:rule, [:email, filled]], [:rule, [:email, format]]]]]]
31
+ )
26
32
  end
27
33
  end
28
34
 
29
35
  describe '#then' do
30
36
  it 'returns an implication' do
31
- expect(left.then(right).to_ast).to match_array([:implication, [filled, format]])
37
+ expect(left.then(right).to_ast).to match_array(
38
+ [:rule, [:email, [:implication, [[:rule, [:email, filled]], [:rule, [:email, format]]]]]]
39
+ )
32
40
  end
33
41
  end
34
42
  end
@@ -8,21 +8,19 @@ RSpec.describe Schema::Value do
8
8
  subject(:value) { Schema::Value.new(registry: registry) }
9
9
 
10
10
  let(:expected_ast) do
11
- [:and, [
12
- [:val, p(:key?, :address)],
13
- [:key, [:address, p(:filled?)]]
14
- ]]
11
+ [:rule, [:address, [:and, [
12
+ [:rule, [:address, [:predicate, [:key?, [[:name, :address], [:input, Undefined]]]]]],
13
+ [:rule, [:address, [:key, [:address, [:predicate, [:filled?, [[:input, Undefined]]]]]]]]
14
+ ]]]]
15
15
  end
16
16
 
17
17
  it 'creates a rule for a specified key using a block' do
18
18
  rule = value.required(:address, &:filled?)
19
-
20
19
  expect(rule.to_ast).to eql(expected_ast)
21
20
  end
22
21
 
23
22
  it 'creates a rule for a specified key using a macro' do
24
23
  rule = value.required(:address).filled
25
-
26
24
  expect(rule.to_ast).to eql(expected_ast)
27
25
  end
28
26
  end
@@ -35,8 +33,8 @@ RSpec.describe Schema::Value do
35
33
 
36
34
  expect(rule.to_ast).to eql(
37
35
  [:and, [
38
- [:val, p(:array?)],
39
- [:each, [:val, p(:key?, :method)]]
36
+ [:predicate, [:array?, [[:input, Undefined]]]],
37
+ [:each, [:predicate, [:key?, [[:name, :method], [:input, Undefined]]]]]
40
38
  ]]
41
39
  )
42
40
  end
@@ -49,18 +47,17 @@ RSpec.describe Schema::Value do
49
47
 
50
48
  expect(rule.to_ast).to eql(
51
49
  [:and, [
52
- [:val, p(:array?)],
53
- [:each,
54
- [:set, [
55
- [:and, [
56
- [:val, p(:key?, :method)],
57
- [:key, [:method, p(:str?)]]
58
- ]],
59
- [:and, [
60
- [:val, p(:key?, :amount)],
61
- [:key, [:amount, p(:float?)]]
62
- ]]
63
- ]]]
50
+ [:predicate, [:array?, [[:input, Undefined]]]],
51
+ [:each, [:set, [
52
+ [:rule, [:method, [:and, [
53
+ [:rule, [:method, [:predicate, [:key?, [[:name, :method], [:input, Undefined]]]]]],
54
+ [:rule, [:method, [:key, [:method, [:predicate, [:str?, [[:input, Undefined]]]]]]]]]
55
+ ]]],
56
+ [:rule, [:amount, [:and, [
57
+ [:rule, [:amount, [:predicate, [:key?, [[:name, :amount], [:input, Undefined]]]]]],
58
+ [:rule, [:amount, [:key, [:amount, [:predicate, [:float?, [[:input, Undefined]]]]]]]]
59
+ ]]]]
60
+ ]]]
64
61
  ]]
65
62
  )
66
63
  end
@@ -72,15 +69,15 @@ RSpec.describe Schema::Value do
72
69
  it 'builds hash? & rule created within the block' do
73
70
  rule = user.hash? { required(:email).filled }
74
71
 
75
- expect(rule.to_ast).to eql([
76
- :and, [
77
- [:val, p(:hash?)],
78
- [:and, [
79
- [:val, p(:key?, :email)],
80
- [:key, [:email, p(:filled?)]]
81
- ]]
82
- ]
83
- ])
72
+ expect(rule.to_ast).to eql(
73
+ [:and, [
74
+ [:predicate, [:hash?, [[:input, Undefined]]]],
75
+ [:rule, [:email, [:and, [
76
+ [:rule, [:email, [:predicate, [:key?, [[:name, :email], [:input, Undefined]]]]]],
77
+ [:rule, [:email, [:key, [:email, [:predicate, [:filled?, [[:input, Undefined]]]]]]]]
78
+ ]]]]
79
+ ]]
80
+ )
84
81
  end
85
82
 
86
83
  it 'builds hash? & rule created within the block with deep nesting' do
@@ -95,23 +92,23 @@ RSpec.describe Schema::Value do
95
92
 
96
93
  expect(rule.to_ast).to eql(
97
94
  [:and, [
98
- [:val, p(:hash?)],
99
- [:and, [
100
- [:val, p(:key?, :address)],
101
- [:and, [
102
- [:val, p(:hash?)],
103
- [:key, [
104
- :address, [:set, [
105
- [:and, [
106
- [:val, p(:key?, :city)],
107
- [:key, [:city, p(:filled?)]]]],
108
- [:and, [
109
- [:val, p(:key?, :zipcode)],
110
- [:key, [:zipcode, p(:filled?)]]]]
111
- ]]
112
- ]]
113
- ]]
114
- ]]
95
+ [:predicate, [:hash?, [[:input, Undefined]]]],
96
+ [:rule, [:address, [:and, [
97
+ [:rule, [:address, [:predicate, [:key?, [[:name, :address], [:input, Undefined]]]]]],
98
+ [:rule, [:address, [:and, [
99
+ [:rule, [:address, [:predicate, [:hash?, [[:input, Undefined]]]]]],
100
+ [:rule, [:address, [:key, [:address, [:set, [
101
+ [:rule, [:city, [:and, [
102
+ [:rule, [:city, [:predicate, [:key?, [[:name, :city], [:input, Undefined]]]]]],
103
+ [:rule, [:city, [:key, [:city, [:predicate, [:filled?, [[:input, Undefined]]]]]]]]
104
+ ]]]],
105
+ [:rule, [:zipcode, [:and, [
106
+ [:rule, [:zipcode, [:predicate, [:key?, [[:name, :zipcode], [:input, Undefined]]]]]],
107
+ [:rule, [:zipcode, [:key, [:zipcode, [:predicate, [:filled?, [[:input, Undefined]]]]]]]]
108
+ ]]]]
109
+ ]]]]]]
110
+ ]]]]
111
+ ]]]]
115
112
  ]]
116
113
  )
117
114
  end
@@ -123,12 +120,12 @@ RSpec.describe Schema::Value do
123
120
  it 'builds a negated rule' do
124
121
  not_email = user.required(:email) { str?.not }
125
122
 
126
- expect(not_email.to_ast).to eql([
127
- :and, [
128
- [:val, p(:key?, :email)],
129
- [:not, [:key, [:email, p(:str?)]]]
130
- ]
131
- ])
123
+ expect(not_email.to_ast).to eql(
124
+ [:rule, [:email, [:and, [
125
+ [:rule, [:email, [:predicate, [:key?, [[:name, :email], [:input, Undefined]]]]]],
126
+ [:rule, [:email, [:not, [:key, [:email, [:predicate, [:str?, [[:input, Undefined]]]]]]]]]]
127
+ ]]]
128
+ )
132
129
  end
133
130
  end
134
131
  end
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.9.5
4
+ version: 0.10.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: 2016-08-16 00:00:00.000000000 Z
12
+ date: 2016-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -85,40 +85,54 @@ dependencies:
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0.3'
88
+ version: '0.4'
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 0.3.0
91
+ version: 0.4.0
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '0.3'
98
+ version: '0.4'
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: 0.3.0
101
+ version: 0.4.0
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: dry-types
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '0.8'
108
+ version: '0.9'
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 0.8.1
111
+ version: 0.9.0
112
112
  type: :runtime
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '0.8'
118
+ version: '0.9'
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: 0.8.1
121
+ version: 0.9.0
122
+ - !ruby/object:Gem::Dependency
123
+ name: dry-core
124
+ requirement: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: '0.1'
129
+ type: :runtime
130
+ prerelease: false
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '0.1'
122
136
  - !ruby/object:Gem::Dependency
123
137
  name: bundler
124
138
  requirement: !ruby/object:Gem::Requirement
@@ -196,18 +210,18 @@ files:
196
210
  - examples/nested.rb
197
211
  - lib/dry-validation.rb
198
212
  - lib/dry/validation.rb
199
- - lib/dry/validation/constants.rb
200
213
  - lib/dry/validation/deprecations.rb
201
- - lib/dry/validation/error.rb
202
- - lib/dry/validation/error_compiler.rb
203
214
  - lib/dry/validation/executor.rb
204
- - lib/dry/validation/hint_compiler.rb
215
+ - lib/dry/validation/extensions.rb
216
+ - lib/dry/validation/extensions/monads.rb
217
+ - lib/dry/validation/extensions/struct.rb
205
218
  - lib/dry/validation/input_processor_compiler.rb
206
219
  - lib/dry/validation/input_processor_compiler/form.rb
207
220
  - lib/dry/validation/input_processor_compiler/json.rb
208
221
  - lib/dry/validation/input_processor_compiler/sanitizer.rb
209
222
  - lib/dry/validation/message.rb
210
223
  - lib/dry/validation/message_compiler.rb
224
+ - lib/dry/validation/message_compiler/visitor_opts.rb
211
225
  - lib/dry/validation/message_set.rb
212
226
  - lib/dry/validation/messages.rb
213
227
  - lib/dry/validation/messages/abstract.rb
@@ -230,11 +244,12 @@ files:
230
244
  - lib/dry/validation/type_specs.rb
231
245
  - lib/dry/validation/version.rb
232
246
  - log/.gitkeep
247
+ - spec/extensions/monads/result_spec.rb
248
+ - spec/extensions/struct/schema_spec.rb
233
249
  - spec/fixtures/locales/en.yml
234
250
  - spec/fixtures/locales/pl.yml
235
251
  - spec/integration/custom_error_messages_spec.rb
236
252
  - spec/integration/custom_predicates_spec.rb
237
- - spec/integration/error_compiler_spec.rb
238
253
  - spec/integration/form/predicates/array_spec.rb
239
254
  - spec/integration/form/predicates/empty_spec.rb
240
255
  - spec/integration/form/predicates/eql_spec.rb
@@ -262,7 +277,9 @@ files:
262
277
  - spec/integration/form/predicates/type_spec.rb
263
278
  - spec/integration/hints_spec.rb
264
279
  - spec/integration/injecting_rules_spec.rb
280
+ - spec/integration/json/defining_base_schema_spec.rb
265
281
  - spec/integration/localized_error_messages_spec.rb
282
+ - spec/integration/message_compiler_spec.rb
266
283
  - spec/integration/messages/i18n_spec.rb
267
284
  - spec/integration/optional_keys_spec.rb
268
285
  - spec/integration/result_spec.rb
@@ -275,6 +292,7 @@ files:
275
292
  - spec/integration/schema/dynamic_predicate_args_spec.rb
276
293
  - spec/integration/schema/each_with_set_spec.rb
277
294
  - spec/integration/schema/extending_dsl_spec.rb
295
+ - spec/integration/schema/form/defining_base_schema_spec.rb
278
296
  - spec/integration/schema/form/explicit_types_spec.rb
279
297
  - spec/integration/schema/form_spec.rb
280
298
  - spec/integration/schema/hash_schema_spec.rb
@@ -295,6 +313,7 @@ files:
295
313
  - spec/integration/schema/not_spec.rb
296
314
  - spec/integration/schema/numbers_spec.rb
297
315
  - spec/integration/schema/option_with_default_spec.rb
316
+ - spec/integration/schema/or_spec.rb
298
317
  - spec/integration/schema/predicate_verification_spec.rb
299
318
  - spec/integration/schema/predicates/array_spec.rb
300
319
  - spec/integration/schema/predicates/custom_spec.rb
@@ -325,9 +344,11 @@ files:
325
344
  - spec/integration/schema/predicates/type_spec.rb
326
345
  - spec/integration/schema/reusing_schema_spec.rb
327
346
  - spec/integration/schema/using_types_spec.rb
347
+ - spec/integration/schema/validate_spec.rb
328
348
  - spec/integration/schema/xor_spec.rb
329
349
  - spec/integration/schema_builders_spec.rb
330
350
  - spec/integration/schema_spec.rb
351
+ - spec/shared/message_compiler.rb
331
352
  - spec/shared/predicate_helper.rb
332
353
  - spec/shared/rule_compiler.rb
333
354
  - spec/spec_helper.rb
@@ -335,10 +356,11 @@ files:
335
356
  - spec/support/matchers.rb
336
357
  - spec/support/mutant.rb
337
358
  - spec/support/predicates_integration.rb
338
- - spec/unit/error_compiler_spec.rb
339
- - spec/unit/hint_compiler_spec.rb
340
359
  - spec/unit/input_processor_compiler/form_spec.rb
341
360
  - spec/unit/input_processor_compiler/json_spec.rb
361
+ - spec/unit/message_compiler/visit_failure_spec.rb
362
+ - spec/unit/message_compiler/visit_spec.rb
363
+ - spec/unit/message_compiler_spec.rb
342
364
  - spec/unit/predicate_registry_spec.rb
343
365
  - spec/unit/schema/key_spec.rb
344
366
  - spec/unit/schema/rule_spec.rb
@@ -369,11 +391,12 @@ signing_key:
369
391
  specification_version: 4
370
392
  summary: A simple validation library
371
393
  test_files:
394
+ - spec/extensions/monads/result_spec.rb
395
+ - spec/extensions/struct/schema_spec.rb
372
396
  - spec/fixtures/locales/en.yml
373
397
  - spec/fixtures/locales/pl.yml
374
398
  - spec/integration/custom_error_messages_spec.rb
375
399
  - spec/integration/custom_predicates_spec.rb
376
- - spec/integration/error_compiler_spec.rb
377
400
  - spec/integration/form/predicates/array_spec.rb
378
401
  - spec/integration/form/predicates/empty_spec.rb
379
402
  - spec/integration/form/predicates/eql_spec.rb
@@ -401,7 +424,9 @@ test_files:
401
424
  - spec/integration/form/predicates/type_spec.rb
402
425
  - spec/integration/hints_spec.rb
403
426
  - spec/integration/injecting_rules_spec.rb
427
+ - spec/integration/json/defining_base_schema_spec.rb
404
428
  - spec/integration/localized_error_messages_spec.rb
429
+ - spec/integration/message_compiler_spec.rb
405
430
  - spec/integration/messages/i18n_spec.rb
406
431
  - spec/integration/optional_keys_spec.rb
407
432
  - spec/integration/result_spec.rb
@@ -414,6 +439,7 @@ test_files:
414
439
  - spec/integration/schema/dynamic_predicate_args_spec.rb
415
440
  - spec/integration/schema/each_with_set_spec.rb
416
441
  - spec/integration/schema/extending_dsl_spec.rb
442
+ - spec/integration/schema/form/defining_base_schema_spec.rb
417
443
  - spec/integration/schema/form/explicit_types_spec.rb
418
444
  - spec/integration/schema/form_spec.rb
419
445
  - spec/integration/schema/hash_schema_spec.rb
@@ -434,6 +460,7 @@ test_files:
434
460
  - spec/integration/schema/not_spec.rb
435
461
  - spec/integration/schema/numbers_spec.rb
436
462
  - spec/integration/schema/option_with_default_spec.rb
463
+ - spec/integration/schema/or_spec.rb
437
464
  - spec/integration/schema/predicate_verification_spec.rb
438
465
  - spec/integration/schema/predicates/array_spec.rb
439
466
  - spec/integration/schema/predicates/custom_spec.rb
@@ -464,9 +491,11 @@ test_files:
464
491
  - spec/integration/schema/predicates/type_spec.rb
465
492
  - spec/integration/schema/reusing_schema_spec.rb
466
493
  - spec/integration/schema/using_types_spec.rb
494
+ - spec/integration/schema/validate_spec.rb
467
495
  - spec/integration/schema/xor_spec.rb
468
496
  - spec/integration/schema_builders_spec.rb
469
497
  - spec/integration/schema_spec.rb
498
+ - spec/shared/message_compiler.rb
470
499
  - spec/shared/predicate_helper.rb
471
500
  - spec/shared/rule_compiler.rb
472
501
  - spec/spec_helper.rb
@@ -474,10 +503,11 @@ test_files:
474
503
  - spec/support/matchers.rb
475
504
  - spec/support/mutant.rb
476
505
  - spec/support/predicates_integration.rb
477
- - spec/unit/error_compiler_spec.rb
478
- - spec/unit/hint_compiler_spec.rb
479
506
  - spec/unit/input_processor_compiler/form_spec.rb
480
507
  - spec/unit/input_processor_compiler/json_spec.rb
508
+ - spec/unit/message_compiler/visit_failure_spec.rb
509
+ - spec/unit/message_compiler/visit_spec.rb
510
+ - spec/unit/message_compiler_spec.rb
481
511
  - spec/unit/predicate_registry_spec.rb
482
512
  - spec/unit/schema/key_spec.rb
483
513
  - spec/unit/schema/rule_spec.rb