dry-validation 0.13.3 → 1.4.2

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.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +390 -95
  3. data/LICENSE +1 -1
  4. data/README.md +15 -12
  5. data/config/errors.yml +3 -88
  6. data/dry-validation.gemspec +30 -19
  7. data/lib/dry-validation.rb +2 -0
  8. data/lib/dry/validation.rb +47 -28
  9. data/lib/dry/validation/config.rb +24 -0
  10. data/lib/dry/validation/constants.rb +43 -0
  11. data/lib/dry/validation/contract.rb +160 -0
  12. data/lib/dry/validation/contract/class_interface.rb +222 -0
  13. data/lib/dry/validation/evaluator.rb +198 -0
  14. data/lib/dry/validation/extensions/hints.rb +69 -0
  15. data/lib/dry/validation/extensions/monads.rb +23 -7
  16. data/lib/dry/validation/extensions/predicates_as_macros.rb +75 -0
  17. data/lib/dry/validation/failures.rb +65 -0
  18. data/lib/dry/validation/function.rb +44 -0
  19. data/lib/dry/validation/macro.rb +38 -0
  20. data/lib/dry/validation/macros.rb +104 -0
  21. data/lib/dry/validation/message.rb +79 -79
  22. data/lib/dry/validation/message_set.rb +109 -88
  23. data/lib/dry/validation/messages/resolver.rb +106 -0
  24. data/lib/dry/validation/result.rb +168 -40
  25. data/lib/dry/validation/rule.rb +135 -0
  26. data/lib/dry/validation/schema_ext.rb +46 -0
  27. data/lib/dry/validation/values.rb +95 -0
  28. data/lib/dry/validation/version.rb +3 -1
  29. metadata +45 -335
  30. data/.codeclimate.yml +0 -17
  31. data/.gitignore +0 -9
  32. data/.rspec +0 -3
  33. data/.travis.yml +0 -29
  34. data/CONTRIBUTING.md +0 -31
  35. data/Gemfile +0 -25
  36. data/Rakefile +0 -22
  37. data/benchmarks/benchmark_form_invalid.rb +0 -64
  38. data/benchmarks/benchmark_form_valid.rb +0 -64
  39. data/benchmarks/benchmark_schema_invalid_huge.rb +0 -52
  40. data/benchmarks/profile_schema_call_invalid.rb +0 -20
  41. data/benchmarks/profile_schema_call_valid.rb +0 -20
  42. data/benchmarks/profile_schema_definition.rb +0 -14
  43. data/benchmarks/profile_schema_huge_invalid.rb +0 -30
  44. data/benchmarks/profile_schema_messages_invalid.rb +0 -20
  45. data/benchmarks/suite.rb +0 -5
  46. data/examples/basic.rb +0 -15
  47. data/examples/each.rb +0 -14
  48. data/examples/json.rb +0 -12
  49. data/examples/multiple.rb +0 -27
  50. data/examples/nested.rb +0 -22
  51. data/examples/params.rb +0 -11
  52. data/lib/dry/validation/compat/form.rb +0 -67
  53. data/lib/dry/validation/deprecations.rb +0 -24
  54. data/lib/dry/validation/executor.rb +0 -91
  55. data/lib/dry/validation/extensions.rb +0 -7
  56. data/lib/dry/validation/extensions/struct.rb +0 -32
  57. data/lib/dry/validation/input_processor_compiler.rb +0 -137
  58. data/lib/dry/validation/input_processor_compiler/json.rb +0 -45
  59. data/lib/dry/validation/input_processor_compiler/params.rb +0 -49
  60. data/lib/dry/validation/input_processor_compiler/sanitizer.rb +0 -47
  61. data/lib/dry/validation/message_compiler.rb +0 -188
  62. data/lib/dry/validation/message_compiler/visitor_opts.rb +0 -37
  63. data/lib/dry/validation/messages.rb +0 -14
  64. data/lib/dry/validation/messages/abstract.rb +0 -119
  65. data/lib/dry/validation/messages/i18n.rb +0 -47
  66. data/lib/dry/validation/messages/namespaced.rb +0 -39
  67. data/lib/dry/validation/messages/yaml.rb +0 -61
  68. data/lib/dry/validation/predicate_registry.rb +0 -115
  69. data/lib/dry/validation/predicates.rb +0 -19
  70. data/lib/dry/validation/schema.rb +0 -126
  71. data/lib/dry/validation/schema/check.rb +0 -37
  72. data/lib/dry/validation/schema/class_interface.rb +0 -190
  73. data/lib/dry/validation/schema/deprecated.rb +0 -30
  74. data/lib/dry/validation/schema/dsl.rb +0 -118
  75. data/lib/dry/validation/schema/form.rb +0 -9
  76. data/lib/dry/validation/schema/json.rb +0 -21
  77. data/lib/dry/validation/schema/key.rb +0 -71
  78. data/lib/dry/validation/schema/params.rb +0 -22
  79. data/lib/dry/validation/schema/rule.rb +0 -202
  80. data/lib/dry/validation/schema/value.rb +0 -211
  81. data/lib/dry/validation/schema_compiler.rb +0 -81
  82. data/lib/dry/validation/template.rb +0 -66
  83. data/lib/dry/validation/type_specs.rb +0 -70
  84. data/spec/extensions/monads/result_spec.rb +0 -40
  85. data/spec/extensions/struct/schema_spec.rb +0 -32
  86. data/spec/fixtures/locales/en.yml +0 -8
  87. data/spec/fixtures/locales/pl.yml +0 -22
  88. data/spec/integration/custom_error_messages_spec.rb +0 -54
  89. data/spec/integration/custom_predicates_spec.rb +0 -228
  90. data/spec/integration/hints_spec.rb +0 -170
  91. data/spec/integration/injecting_rules_spec.rb +0 -30
  92. data/spec/integration/json/defining_base_schema_spec.rb +0 -41
  93. data/spec/integration/localized_error_messages_spec.rb +0 -72
  94. data/spec/integration/message_compiler_spec.rb +0 -405
  95. data/spec/integration/messages/i18n_spec.rb +0 -104
  96. data/spec/integration/optional_keys_spec.rb +0 -28
  97. data/spec/integration/params/predicates/array_spec.rb +0 -287
  98. data/spec/integration/params/predicates/empty_spec.rb +0 -263
  99. data/spec/integration/params/predicates/eql_spec.rb +0 -327
  100. data/spec/integration/params/predicates/even_spec.rb +0 -455
  101. data/spec/integration/params/predicates/excluded_from_spec.rb +0 -455
  102. data/spec/integration/params/predicates/excludes_spec.rb +0 -391
  103. data/spec/integration/params/predicates/false_spec.rb +0 -455
  104. data/spec/integration/params/predicates/filled_spec.rb +0 -467
  105. data/spec/integration/params/predicates/format_spec.rb +0 -454
  106. data/spec/integration/params/predicates/gt_spec.rb +0 -519
  107. data/spec/integration/params/predicates/gteq_spec.rb +0 -519
  108. data/spec/integration/params/predicates/included_in_spec.rb +0 -455
  109. data/spec/integration/params/predicates/includes_spec.rb +0 -391
  110. data/spec/integration/params/predicates/key_spec.rb +0 -67
  111. data/spec/integration/params/predicates/lt_spec.rb +0 -519
  112. data/spec/integration/params/predicates/lteq_spec.rb +0 -519
  113. data/spec/integration/params/predicates/max_size_spec.rb +0 -391
  114. data/spec/integration/params/predicates/min_size_spec.rb +0 -391
  115. data/spec/integration/params/predicates/none_spec.rb +0 -265
  116. data/spec/integration/params/predicates/not_eql_spec.rb +0 -327
  117. data/spec/integration/params/predicates/odd_spec.rb +0 -455
  118. data/spec/integration/params/predicates/size/fixed_spec.rb +0 -393
  119. data/spec/integration/params/predicates/size/range_spec.rb +0 -396
  120. data/spec/integration/params/predicates/true_spec.rb +0 -455
  121. data/spec/integration/params/predicates/type_spec.rb +0 -391
  122. data/spec/integration/result_spec.rb +0 -81
  123. data/spec/integration/schema/array_schema_spec.rb +0 -59
  124. data/spec/integration/schema/check_rules_spec.rb +0 -119
  125. data/spec/integration/schema/check_with_nested_el_spec.rb +0 -37
  126. data/spec/integration/schema/check_with_nth_el_spec.rb +0 -25
  127. data/spec/integration/schema/default_settings_spec.rb +0 -11
  128. data/spec/integration/schema/defining_base_schema_spec.rb +0 -41
  129. data/spec/integration/schema/dynamic_predicate_args_spec.rb +0 -43
  130. data/spec/integration/schema/each_with_set_spec.rb +0 -70
  131. data/spec/integration/schema/extending_dsl_spec.rb +0 -27
  132. data/spec/integration/schema/form_spec.rb +0 -236
  133. data/spec/integration/schema/hash_schema_spec.rb +0 -47
  134. data/spec/integration/schema/inheriting_schema_spec.rb +0 -31
  135. data/spec/integration/schema/input_processor_spec.rb +0 -46
  136. data/spec/integration/schema/json/explicit_types_spec.rb +0 -157
  137. data/spec/integration/schema/json_spec.rb +0 -163
  138. data/spec/integration/schema/macros/confirmation_spec.rb +0 -35
  139. data/spec/integration/schema/macros/each_spec.rb +0 -268
  140. data/spec/integration/schema/macros/filled_spec.rb +0 -87
  141. data/spec/integration/schema/macros/input_spec.rb +0 -139
  142. data/spec/integration/schema/macros/maybe_spec.rb +0 -99
  143. data/spec/integration/schema/macros/rule_spec.rb +0 -75
  144. data/spec/integration/schema/macros/value_spec.rb +0 -119
  145. data/spec/integration/schema/macros/when_spec.rb +0 -62
  146. data/spec/integration/schema/nested_schemas_spec.rb +0 -236
  147. data/spec/integration/schema/nested_values_spec.rb +0 -46
  148. data/spec/integration/schema/not_spec.rb +0 -34
  149. data/spec/integration/schema/numbers_spec.rb +0 -19
  150. data/spec/integration/schema/option_with_default_spec.rb +0 -64
  151. data/spec/integration/schema/or_spec.rb +0 -87
  152. data/spec/integration/schema/params/defining_base_schema_spec.rb +0 -41
  153. data/spec/integration/schema/params/explicit_types_spec.rb +0 -195
  154. data/spec/integration/schema/params_spec.rb +0 -234
  155. data/spec/integration/schema/predicate_verification_spec.rb +0 -9
  156. data/spec/integration/schema/predicates/array_spec.rb +0 -295
  157. data/spec/integration/schema/predicates/custom_spec.rb +0 -103
  158. data/spec/integration/schema/predicates/empty_spec.rb +0 -263
  159. data/spec/integration/schema/predicates/eql_spec.rb +0 -327
  160. data/spec/integration/schema/predicates/even_spec.rb +0 -455
  161. data/spec/integration/schema/predicates/excluded_from/array_spec.rb +0 -459
  162. data/spec/integration/schema/predicates/excluded_from/range_spec.rb +0 -459
  163. data/spec/integration/schema/predicates/excludes_spec.rb +0 -391
  164. data/spec/integration/schema/predicates/filled_spec.rb +0 -467
  165. data/spec/integration/schema/predicates/format_spec.rb +0 -455
  166. data/spec/integration/schema/predicates/gt_spec.rb +0 -519
  167. data/spec/integration/schema/predicates/gteq_spec.rb +0 -519
  168. data/spec/integration/schema/predicates/hash_spec.rb +0 -69
  169. data/spec/integration/schema/predicates/included_in/array_spec.rb +0 -459
  170. data/spec/integration/schema/predicates/included_in/range_spec.rb +0 -459
  171. data/spec/integration/schema/predicates/includes_spec.rb +0 -391
  172. data/spec/integration/schema/predicates/key_spec.rb +0 -88
  173. data/spec/integration/schema/predicates/lt_spec.rb +0 -520
  174. data/spec/integration/schema/predicates/lteq_spec.rb +0 -519
  175. data/spec/integration/schema/predicates/max_size_spec.rb +0 -391
  176. data/spec/integration/schema/predicates/min_size_spec.rb +0 -391
  177. data/spec/integration/schema/predicates/none_spec.rb +0 -265
  178. data/spec/integration/schema/predicates/not_eql_spec.rb +0 -391
  179. data/spec/integration/schema/predicates/odd_spec.rb +0 -455
  180. data/spec/integration/schema/predicates/size/fixed_spec.rb +0 -398
  181. data/spec/integration/schema/predicates/size/range_spec.rb +0 -395
  182. data/spec/integration/schema/predicates/type_spec.rb +0 -413
  183. data/spec/integration/schema/reusing_schema_spec.rb +0 -33
  184. data/spec/integration/schema/using_types_spec.rb +0 -135
  185. data/spec/integration/schema/validate_spec.rb +0 -120
  186. data/spec/integration/schema/xor_spec.rb +0 -35
  187. data/spec/integration/schema_builders_spec.rb +0 -17
  188. data/spec/integration/schema_spec.rb +0 -173
  189. data/spec/shared/message_compiler.rb +0 -11
  190. data/spec/shared/predicate_helper.rb +0 -15
  191. data/spec/shared/rule_compiler.rb +0 -8
  192. data/spec/spec_helper.rb +0 -62
  193. data/spec/support/define_struct.rb +0 -25
  194. data/spec/support/matchers.rb +0 -38
  195. data/spec/support/mutant.rb +0 -9
  196. data/spec/support/predicates_integration.rb +0 -7
  197. data/spec/unit/input_processor_compiler/json_spec.rb +0 -283
  198. data/spec/unit/input_processor_compiler/params_spec.rb +0 -328
  199. data/spec/unit/message_compiler/visit_failure_spec.rb +0 -38
  200. data/spec/unit/message_compiler/visit_spec.rb +0 -16
  201. data/spec/unit/message_compiler_spec.rb +0 -7
  202. data/spec/unit/predicate_registry_spec.rb +0 -34
  203. data/spec/unit/schema/key_spec.rb +0 -38
  204. data/spec/unit/schema/rule_spec.rb +0 -42
  205. data/spec/unit/schema/value_spec.rb +0 -131
  206. data/spec/unit/schema_spec.rb +0 -35
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/equalizer'
4
+
5
+ require 'dry/validation/constants'
6
+ require 'dry/validation/function'
7
+
8
+ module Dry
9
+ module Validation
10
+ # Rules capture configuration and evaluator blocks
11
+ #
12
+ # When a rule is applied, it creates an `Evaluator` using schema result and its
13
+ # block will be evaluated in the context of the evaluator.
14
+ #
15
+ # @see Contract#rule
16
+ #
17
+ # @api public
18
+ class Rule < Function
19
+ include Dry::Equalizer(:keys, :block, inspect: false)
20
+
21
+ # @!attribute [r] keys
22
+ # @return [Array<Symbol, String, Hash>]
23
+ # @api private
24
+ option :keys
25
+
26
+ # @!attribute [r] macros
27
+ # @return [Array<Symbol>]
28
+ # @api private
29
+ option :macros, default: proc { EMPTY_ARRAY.dup }
30
+
31
+ # Evaluate the rule within the provided context
32
+ #
33
+ # @param [Contract] contract
34
+ # @param [Result] result
35
+ #
36
+ # @api private
37
+ def call(contract, result)
38
+ Evaluator.new(
39
+ contract,
40
+ keys: keys,
41
+ macros: macros,
42
+ block_options: block_options,
43
+ result: result,
44
+ values: result.values,
45
+ _context: result.context,
46
+ &block
47
+ )
48
+ end
49
+
50
+ # Define which macros should be executed
51
+ #
52
+ # @see Contract#rule
53
+ # @return [Rule]
54
+ #
55
+ # @api public
56
+ def validate(*macros, &block)
57
+ @macros = parse_macros(*macros)
58
+ @block = block if block
59
+ self
60
+ end
61
+
62
+ # Define a validation function for each element of an array
63
+ #
64
+ # The function will be applied only if schema checks passed
65
+ # for a given array item.
66
+ #
67
+ # @example
68
+ # rule(:nums).each do
69
+ # key.failure("must be greater than 0") if value < 0
70
+ # end
71
+ # rule(:nums).each(min: 3)
72
+ # rule(address: :city) do
73
+ # key.failure("oops") if value != 'Munich'
74
+ # end
75
+ #
76
+ # @return [Rule]
77
+ #
78
+ # @api public
79
+ def each(*macros, &block)
80
+ root = keys[0]
81
+ macros = parse_macros(*macros)
82
+ @keys = []
83
+
84
+ @block = proc do
85
+ unless result.base_error?(root) || !values.key?(root)
86
+ values[root].each_with_index do |_, idx|
87
+ path = [*Schema::Path[root].to_a, idx]
88
+
89
+ next if result.error?(path)
90
+
91
+ evaluator = with(macros: macros, keys: [path], &block)
92
+
93
+ failures.concat(evaluator.failures)
94
+ end
95
+ end
96
+ end
97
+
98
+ @block_options = map_keywords(block) if block
99
+
100
+ self
101
+ end
102
+
103
+ # Return a nice string representation
104
+ #
105
+ # @return [String]
106
+ #
107
+ # @api public
108
+ def inspect
109
+ %(#<#{self.class} keys=#{keys.inspect}>)
110
+ end
111
+
112
+ # Parse function arguments into macros structure
113
+ #
114
+ # @return [Array]
115
+ #
116
+ # @api private
117
+ def parse_macros(*args)
118
+ args.each_with_object([]) do |spec, macros|
119
+ case spec
120
+ when Hash
121
+ add_macro_from_hash(macros, spec)
122
+ else
123
+ macros << Array(spec)
124
+ end
125
+ end
126
+ end
127
+
128
+ def add_macro_from_hash(macros, spec)
129
+ spec.each do |k, v|
130
+ macros << [k, v.is_a?(Array) ? v : [v]]
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/schema/key'
4
+ require 'dry/schema/key_map'
5
+
6
+ module Dry
7
+ module Schema
8
+ class Path
9
+ # @api private
10
+ def multi_value?
11
+ last.is_a?(Array)
12
+ end
13
+
14
+ # @api private
15
+ def expand
16
+ to_a[0..-2].product(last).map { |spec| self.class[spec] }
17
+ end
18
+ end
19
+
20
+ # @api private
21
+ #
22
+ # TODO: this should be moved to dry-schema at some point
23
+ class Key
24
+ # @api private
25
+ def to_dot_notation
26
+ [name.to_s]
27
+ end
28
+
29
+ # @api private
30
+ class Hash < Key
31
+ # @api private
32
+ def to_dot_notation
33
+ [name].product(members.flat_map(&:to_dot_notation)).map { |e| e.join(DOT) }
34
+ end
35
+ end
36
+ end
37
+
38
+ # @api private
39
+ class KeyMap
40
+ # @api private
41
+ def to_dot_notation
42
+ @to_dot_notation ||= map(&:to_dot_notation).flatten
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/equalizer'
4
+ require 'dry/schema/path'
5
+ require 'dry/validation/constants'
6
+
7
+ module Dry
8
+ module Validation
9
+ # A convenient wrapper for data processed by schemas
10
+ #
11
+ # Values are available within the rule blocks. They act as hash-like
12
+ # objects and expose a convenient API for accessing data.
13
+ #
14
+ # @api public
15
+ class Values
16
+ include Enumerable
17
+ include Dry::Equalizer(:data)
18
+
19
+ # Schema's result output
20
+ #
21
+ # @return [Hash]
22
+ #
23
+ # @api private
24
+ attr_reader :data
25
+
26
+ # @api private
27
+ def initialize(data)
28
+ @data = data
29
+ end
30
+
31
+ # Read from the provided key
32
+ #
33
+ # @example
34
+ # rule(:age) do
35
+ # key.failure('must be > 18') if values[:age] <= 18
36
+ # end
37
+ #
38
+ # @param [Symbol] key
39
+ #
40
+ # @return [Object]
41
+ #
42
+ # @api public
43
+ def [](*args)
44
+ return data.dig(*args) if args.size > 1
45
+
46
+ case (key = args[0])
47
+ when Symbol, String, Array, Hash
48
+ keys = Schema::Path[key].to_a
49
+
50
+ return data.dig(*keys) unless keys.last.is_a?(Array)
51
+
52
+ last = keys.pop
53
+ vals = self.class.new(data.dig(*keys))
54
+ vals.fetch_values(*last) { nil }
55
+ else
56
+ raise ArgumentError, '+key+ must be a valid path specification'
57
+ end
58
+ end
59
+
60
+ # @api public
61
+ def key?(key, hash = data)
62
+ return hash.key?(key) if key.is_a?(Symbol)
63
+
64
+ Schema::Path[key].reduce(hash) do |a, e|
65
+ if e.is_a?(Array)
66
+ result = e.all? { |k| key?(k, a) }
67
+ return result
68
+ else
69
+ return false unless a.is_a?(Array) ? (e >= 0 && e < a.size) : a.key?(e)
70
+ end
71
+ a[e]
72
+ end
73
+
74
+ true
75
+ end
76
+
77
+ # @api private
78
+ def respond_to_missing?(meth, include_private = false)
79
+ super || data.respond_to?(meth, include_private)
80
+ end
81
+
82
+ private
83
+
84
+ # @api private
85
+ def method_missing(meth, *args, &block)
86
+ if data.respond_to?(meth)
87
+ data.public_send(meth, *args, &block)
88
+ else
89
+ super
90
+ end
91
+ end
92
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
93
+ end
94
+ end
95
+ end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dry
2
4
  module Validation
3
- VERSION = '0.13.3'.freeze
5
+ VERSION = '1.4.2'
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
- - Andy Holland
8
7
  - Piotr Solnica
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2019-05-21 00:00:00.000000000 Z
11
+ date: 2020-01-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: concurrent-ruby
@@ -26,93 +25,87 @@ dependencies:
26
25
  - !ruby/object:Gem::Version
27
26
  version: '1.0'
28
27
  - !ruby/object:Gem::Dependency
29
- name: dry-configurable
28
+ name: dry-container
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
31
  - - "~>"
33
32
  - !ruby/object:Gem::Version
34
- version: '0.1'
33
+ version: '0.7'
35
34
  - - ">="
36
35
  - !ruby/object:Gem::Version
37
- version: 0.1.3
36
+ version: 0.7.1
38
37
  type: :runtime
39
38
  prerelease: false
40
39
  version_requirements: !ruby/object:Gem::Requirement
41
40
  requirements:
42
41
  - - "~>"
43
42
  - !ruby/object:Gem::Version
44
- version: '0.1'
43
+ version: '0.7'
45
44
  - - ">="
46
45
  - !ruby/object:Gem::Version
47
- version: 0.1.3
46
+ version: 0.7.1
48
47
  - !ruby/object:Gem::Dependency
49
- name: dry-equalizer
48
+ name: dry-core
50
49
  requirement: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '0.2'
53
+ version: '0.4'
55
54
  type: :runtime
56
55
  prerelease: false
57
56
  version_requirements: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '0.2'
60
+ version: '0.4'
62
61
  - !ruby/object:Gem::Dependency
63
- name: dry-logic
62
+ name: dry-equalizer
64
63
  requirement: !ruby/object:Gem::Requirement
65
64
  requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: 0.5.0
69
65
  - - "~>"
70
66
  - !ruby/object:Gem::Version
71
- version: '0.5'
67
+ version: '0.2'
72
68
  type: :runtime
73
69
  prerelease: false
74
70
  version_requirements: !ruby/object:Gem::Requirement
75
71
  requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: 0.5.0
79
72
  - - "~>"
80
73
  - !ruby/object:Gem::Version
81
- version: '0.5'
74
+ version: '0.2'
82
75
  - !ruby/object:Gem::Dependency
83
- name: dry-types
76
+ name: dry-initializer
84
77
  requirement: !ruby/object:Gem::Requirement
85
78
  requirements:
86
79
  - - "~>"
87
80
  - !ruby/object:Gem::Version
88
- version: 0.14.0
81
+ version: '3.0'
89
82
  type: :runtime
90
83
  prerelease: false
91
84
  version_requirements: !ruby/object:Gem::Requirement
92
85
  requirements:
93
86
  - - "~>"
94
87
  - !ruby/object:Gem::Version
95
- version: 0.14.0
88
+ version: '3.0'
96
89
  - !ruby/object:Gem::Dependency
97
- name: dry-core
90
+ name: dry-schema
98
91
  requirement: !ruby/object:Gem::Requirement
99
92
  requirements:
100
93
  - - "~>"
101
94
  - !ruby/object:Gem::Version
102
- version: '0.2'
95
+ version: '1.4'
103
96
  - - ">="
104
97
  - !ruby/object:Gem::Version
105
- version: 0.2.1
98
+ version: 1.4.3
106
99
  type: :runtime
107
100
  prerelease: false
108
101
  version_requirements: !ruby/object:Gem::Requirement
109
102
  requirements:
110
103
  - - "~>"
111
104
  - !ruby/object:Gem::Version
112
- version: '0.2'
105
+ version: '1.4'
113
106
  - - ">="
114
107
  - !ruby/object:Gem::Version
115
- version: 0.2.1
108
+ version: 1.4.3
116
109
  - !ruby/object:Gem::Dependency
117
110
  name: bundler
118
111
  requirement: !ruby/object:Gem::Requirement
@@ -155,208 +148,48 @@ dependencies:
155
148
  - - ">="
156
149
  - !ruby/object:Gem::Version
157
150
  version: '0'
158
- description:
151
+ description: Validation library
159
152
  email:
160
- - andyholland1991@aol.com
161
153
  - piotr.solnica@gmail.com
162
154
  executables: []
163
155
  extensions: []
164
156
  extra_rdoc_files: []
165
157
  files:
166
- - ".codeclimate.yml"
167
- - ".gitignore"
168
- - ".rspec"
169
- - ".travis.yml"
170
158
  - CHANGELOG.md
171
- - CONTRIBUTING.md
172
- - Gemfile
173
159
  - LICENSE
174
160
  - README.md
175
- - Rakefile
176
- - benchmarks/benchmark_form_invalid.rb
177
- - benchmarks/benchmark_form_valid.rb
178
- - benchmarks/benchmark_schema_invalid_huge.rb
179
- - benchmarks/profile_schema_call_invalid.rb
180
- - benchmarks/profile_schema_call_valid.rb
181
- - benchmarks/profile_schema_definition.rb
182
- - benchmarks/profile_schema_huge_invalid.rb
183
- - benchmarks/profile_schema_messages_invalid.rb
184
- - benchmarks/suite.rb
185
161
  - config/errors.yml
186
162
  - dry-validation.gemspec
187
- - examples/basic.rb
188
- - examples/each.rb
189
- - examples/json.rb
190
- - examples/multiple.rb
191
- - examples/nested.rb
192
- - examples/params.rb
193
163
  - lib/dry-validation.rb
194
164
  - lib/dry/validation.rb
195
- - lib/dry/validation/compat/form.rb
196
- - lib/dry/validation/deprecations.rb
197
- - lib/dry/validation/executor.rb
198
- - lib/dry/validation/extensions.rb
165
+ - lib/dry/validation/config.rb
166
+ - lib/dry/validation/constants.rb
167
+ - lib/dry/validation/contract.rb
168
+ - lib/dry/validation/contract/class_interface.rb
169
+ - lib/dry/validation/evaluator.rb
170
+ - lib/dry/validation/extensions/hints.rb
199
171
  - lib/dry/validation/extensions/monads.rb
200
- - lib/dry/validation/extensions/struct.rb
201
- - lib/dry/validation/input_processor_compiler.rb
202
- - lib/dry/validation/input_processor_compiler/json.rb
203
- - lib/dry/validation/input_processor_compiler/params.rb
204
- - lib/dry/validation/input_processor_compiler/sanitizer.rb
172
+ - lib/dry/validation/extensions/predicates_as_macros.rb
173
+ - lib/dry/validation/failures.rb
174
+ - lib/dry/validation/function.rb
175
+ - lib/dry/validation/macro.rb
176
+ - lib/dry/validation/macros.rb
205
177
  - lib/dry/validation/message.rb
206
- - lib/dry/validation/message_compiler.rb
207
- - lib/dry/validation/message_compiler/visitor_opts.rb
208
178
  - lib/dry/validation/message_set.rb
209
- - lib/dry/validation/messages.rb
210
- - lib/dry/validation/messages/abstract.rb
211
- - lib/dry/validation/messages/i18n.rb
212
- - lib/dry/validation/messages/namespaced.rb
213
- - lib/dry/validation/messages/yaml.rb
214
- - lib/dry/validation/predicate_registry.rb
215
- - lib/dry/validation/predicates.rb
179
+ - lib/dry/validation/messages/resolver.rb
216
180
  - lib/dry/validation/result.rb
217
- - lib/dry/validation/schema.rb
218
- - lib/dry/validation/schema/check.rb
219
- - lib/dry/validation/schema/class_interface.rb
220
- - lib/dry/validation/schema/deprecated.rb
221
- - lib/dry/validation/schema/dsl.rb
222
- - lib/dry/validation/schema/form.rb
223
- - lib/dry/validation/schema/json.rb
224
- - lib/dry/validation/schema/key.rb
225
- - lib/dry/validation/schema/params.rb
226
- - lib/dry/validation/schema/rule.rb
227
- - lib/dry/validation/schema/value.rb
228
- - lib/dry/validation/schema_compiler.rb
229
- - lib/dry/validation/template.rb
230
- - lib/dry/validation/type_specs.rb
181
+ - lib/dry/validation/rule.rb
182
+ - lib/dry/validation/schema_ext.rb
183
+ - lib/dry/validation/values.rb
231
184
  - lib/dry/validation/version.rb
232
- - log/.gitkeep
233
- - spec/extensions/monads/result_spec.rb
234
- - spec/extensions/struct/schema_spec.rb
235
- - spec/fixtures/locales/en.yml
236
- - spec/fixtures/locales/pl.yml
237
- - spec/integration/custom_error_messages_spec.rb
238
- - spec/integration/custom_predicates_spec.rb
239
- - spec/integration/hints_spec.rb
240
- - spec/integration/injecting_rules_spec.rb
241
- - spec/integration/json/defining_base_schema_spec.rb
242
- - spec/integration/localized_error_messages_spec.rb
243
- - spec/integration/message_compiler_spec.rb
244
- - spec/integration/messages/i18n_spec.rb
245
- - spec/integration/optional_keys_spec.rb
246
- - spec/integration/params/predicates/array_spec.rb
247
- - spec/integration/params/predicates/empty_spec.rb
248
- - spec/integration/params/predicates/eql_spec.rb
249
- - spec/integration/params/predicates/even_spec.rb
250
- - spec/integration/params/predicates/excluded_from_spec.rb
251
- - spec/integration/params/predicates/excludes_spec.rb
252
- - spec/integration/params/predicates/false_spec.rb
253
- - spec/integration/params/predicates/filled_spec.rb
254
- - spec/integration/params/predicates/format_spec.rb
255
- - spec/integration/params/predicates/gt_spec.rb
256
- - spec/integration/params/predicates/gteq_spec.rb
257
- - spec/integration/params/predicates/included_in_spec.rb
258
- - spec/integration/params/predicates/includes_spec.rb
259
- - spec/integration/params/predicates/key_spec.rb
260
- - spec/integration/params/predicates/lt_spec.rb
261
- - spec/integration/params/predicates/lteq_spec.rb
262
- - spec/integration/params/predicates/max_size_spec.rb
263
- - spec/integration/params/predicates/min_size_spec.rb
264
- - spec/integration/params/predicates/none_spec.rb
265
- - spec/integration/params/predicates/not_eql_spec.rb
266
- - spec/integration/params/predicates/odd_spec.rb
267
- - spec/integration/params/predicates/size/fixed_spec.rb
268
- - spec/integration/params/predicates/size/range_spec.rb
269
- - spec/integration/params/predicates/true_spec.rb
270
- - spec/integration/params/predicates/type_spec.rb
271
- - spec/integration/result_spec.rb
272
- - spec/integration/schema/array_schema_spec.rb
273
- - spec/integration/schema/check_rules_spec.rb
274
- - spec/integration/schema/check_with_nested_el_spec.rb
275
- - spec/integration/schema/check_with_nth_el_spec.rb
276
- - spec/integration/schema/default_settings_spec.rb
277
- - spec/integration/schema/defining_base_schema_spec.rb
278
- - spec/integration/schema/dynamic_predicate_args_spec.rb
279
- - spec/integration/schema/each_with_set_spec.rb
280
- - spec/integration/schema/extending_dsl_spec.rb
281
- - spec/integration/schema/form_spec.rb
282
- - spec/integration/schema/hash_schema_spec.rb
283
- - spec/integration/schema/inheriting_schema_spec.rb
284
- - spec/integration/schema/input_processor_spec.rb
285
- - spec/integration/schema/json/explicit_types_spec.rb
286
- - spec/integration/schema/json_spec.rb
287
- - spec/integration/schema/macros/confirmation_spec.rb
288
- - spec/integration/schema/macros/each_spec.rb
289
- - spec/integration/schema/macros/filled_spec.rb
290
- - spec/integration/schema/macros/input_spec.rb
291
- - spec/integration/schema/macros/maybe_spec.rb
292
- - spec/integration/schema/macros/rule_spec.rb
293
- - spec/integration/schema/macros/value_spec.rb
294
- - spec/integration/schema/macros/when_spec.rb
295
- - spec/integration/schema/nested_schemas_spec.rb
296
- - spec/integration/schema/nested_values_spec.rb
297
- - spec/integration/schema/not_spec.rb
298
- - spec/integration/schema/numbers_spec.rb
299
- - spec/integration/schema/option_with_default_spec.rb
300
- - spec/integration/schema/or_spec.rb
301
- - spec/integration/schema/params/defining_base_schema_spec.rb
302
- - spec/integration/schema/params/explicit_types_spec.rb
303
- - spec/integration/schema/params_spec.rb
304
- - spec/integration/schema/predicate_verification_spec.rb
305
- - spec/integration/schema/predicates/array_spec.rb
306
- - spec/integration/schema/predicates/custom_spec.rb
307
- - spec/integration/schema/predicates/empty_spec.rb
308
- - spec/integration/schema/predicates/eql_spec.rb
309
- - spec/integration/schema/predicates/even_spec.rb
310
- - spec/integration/schema/predicates/excluded_from/array_spec.rb
311
- - spec/integration/schema/predicates/excluded_from/range_spec.rb
312
- - spec/integration/schema/predicates/excludes_spec.rb
313
- - spec/integration/schema/predicates/filled_spec.rb
314
- - spec/integration/schema/predicates/format_spec.rb
315
- - spec/integration/schema/predicates/gt_spec.rb
316
- - spec/integration/schema/predicates/gteq_spec.rb
317
- - spec/integration/schema/predicates/hash_spec.rb
318
- - spec/integration/schema/predicates/included_in/array_spec.rb
319
- - spec/integration/schema/predicates/included_in/range_spec.rb
320
- - spec/integration/schema/predicates/includes_spec.rb
321
- - spec/integration/schema/predicates/key_spec.rb
322
- - spec/integration/schema/predicates/lt_spec.rb
323
- - spec/integration/schema/predicates/lteq_spec.rb
324
- - spec/integration/schema/predicates/max_size_spec.rb
325
- - spec/integration/schema/predicates/min_size_spec.rb
326
- - spec/integration/schema/predicates/none_spec.rb
327
- - spec/integration/schema/predicates/not_eql_spec.rb
328
- - spec/integration/schema/predicates/odd_spec.rb
329
- - spec/integration/schema/predicates/size/fixed_spec.rb
330
- - spec/integration/schema/predicates/size/range_spec.rb
331
- - spec/integration/schema/predicates/type_spec.rb
332
- - spec/integration/schema/reusing_schema_spec.rb
333
- - spec/integration/schema/using_types_spec.rb
334
- - spec/integration/schema/validate_spec.rb
335
- - spec/integration/schema/xor_spec.rb
336
- - spec/integration/schema_builders_spec.rb
337
- - spec/integration/schema_spec.rb
338
- - spec/shared/message_compiler.rb
339
- - spec/shared/predicate_helper.rb
340
- - spec/shared/rule_compiler.rb
341
- - spec/spec_helper.rb
342
- - spec/support/define_struct.rb
343
- - spec/support/matchers.rb
344
- - spec/support/mutant.rb
345
- - spec/support/predicates_integration.rb
346
- - spec/unit/input_processor_compiler/json_spec.rb
347
- - spec/unit/input_processor_compiler/params_spec.rb
348
- - spec/unit/message_compiler/visit_failure_spec.rb
349
- - spec/unit/message_compiler/visit_spec.rb
350
- - spec/unit/message_compiler_spec.rb
351
- - spec/unit/predicate_registry_spec.rb
352
- - spec/unit/schema/key_spec.rb
353
- - spec/unit/schema/rule_spec.rb
354
- - spec/unit/schema/value_spec.rb
355
- - spec/unit/schema_spec.rb
356
- homepage: https://github.com/dry-rb/dry-validation
185
+ homepage: https://dry-rb.org/gems/dry-validation
357
186
  licenses:
358
187
  - MIT
359
- metadata: {}
188
+ metadata:
189
+ allowed_push_host: https://rubygems.org
190
+ changelog_uri: https://github.com/dry-rb/dry-validation/blob/master/CHANGELOG.md
191
+ source_code_uri: https://github.com/dry-rb/dry-validation
192
+ bug_tracker_uri: https://github.com/dry-rb/dry-validation/issues
360
193
  post_install_message:
361
194
  rdoc_options: []
362
195
  require_paths:
@@ -375,128 +208,5 @@ requirements: []
375
208
  rubygems_version: 3.0.3
376
209
  signing_key:
377
210
  specification_version: 4
378
- summary: A simple validation library
379
- test_files:
380
- - spec/extensions/monads/result_spec.rb
381
- - spec/extensions/struct/schema_spec.rb
382
- - spec/fixtures/locales/en.yml
383
- - spec/fixtures/locales/pl.yml
384
- - spec/integration/custom_error_messages_spec.rb
385
- - spec/integration/custom_predicates_spec.rb
386
- - spec/integration/hints_spec.rb
387
- - spec/integration/injecting_rules_spec.rb
388
- - spec/integration/json/defining_base_schema_spec.rb
389
- - spec/integration/localized_error_messages_spec.rb
390
- - spec/integration/message_compiler_spec.rb
391
- - spec/integration/messages/i18n_spec.rb
392
- - spec/integration/optional_keys_spec.rb
393
- - spec/integration/params/predicates/array_spec.rb
394
- - spec/integration/params/predicates/empty_spec.rb
395
- - spec/integration/params/predicates/eql_spec.rb
396
- - spec/integration/params/predicates/even_spec.rb
397
- - spec/integration/params/predicates/excluded_from_spec.rb
398
- - spec/integration/params/predicates/excludes_spec.rb
399
- - spec/integration/params/predicates/false_spec.rb
400
- - spec/integration/params/predicates/filled_spec.rb
401
- - spec/integration/params/predicates/format_spec.rb
402
- - spec/integration/params/predicates/gt_spec.rb
403
- - spec/integration/params/predicates/gteq_spec.rb
404
- - spec/integration/params/predicates/included_in_spec.rb
405
- - spec/integration/params/predicates/includes_spec.rb
406
- - spec/integration/params/predicates/key_spec.rb
407
- - spec/integration/params/predicates/lt_spec.rb
408
- - spec/integration/params/predicates/lteq_spec.rb
409
- - spec/integration/params/predicates/max_size_spec.rb
410
- - spec/integration/params/predicates/min_size_spec.rb
411
- - spec/integration/params/predicates/none_spec.rb
412
- - spec/integration/params/predicates/not_eql_spec.rb
413
- - spec/integration/params/predicates/odd_spec.rb
414
- - spec/integration/params/predicates/size/fixed_spec.rb
415
- - spec/integration/params/predicates/size/range_spec.rb
416
- - spec/integration/params/predicates/true_spec.rb
417
- - spec/integration/params/predicates/type_spec.rb
418
- - spec/integration/result_spec.rb
419
- - spec/integration/schema/array_schema_spec.rb
420
- - spec/integration/schema/check_rules_spec.rb
421
- - spec/integration/schema/check_with_nested_el_spec.rb
422
- - spec/integration/schema/check_with_nth_el_spec.rb
423
- - spec/integration/schema/default_settings_spec.rb
424
- - spec/integration/schema/defining_base_schema_spec.rb
425
- - spec/integration/schema/dynamic_predicate_args_spec.rb
426
- - spec/integration/schema/each_with_set_spec.rb
427
- - spec/integration/schema/extending_dsl_spec.rb
428
- - spec/integration/schema/form_spec.rb
429
- - spec/integration/schema/hash_schema_spec.rb
430
- - spec/integration/schema/inheriting_schema_spec.rb
431
- - spec/integration/schema/input_processor_spec.rb
432
- - spec/integration/schema/json/explicit_types_spec.rb
433
- - spec/integration/schema/json_spec.rb
434
- - spec/integration/schema/macros/confirmation_spec.rb
435
- - spec/integration/schema/macros/each_spec.rb
436
- - spec/integration/schema/macros/filled_spec.rb
437
- - spec/integration/schema/macros/input_spec.rb
438
- - spec/integration/schema/macros/maybe_spec.rb
439
- - spec/integration/schema/macros/rule_spec.rb
440
- - spec/integration/schema/macros/value_spec.rb
441
- - spec/integration/schema/macros/when_spec.rb
442
- - spec/integration/schema/nested_schemas_spec.rb
443
- - spec/integration/schema/nested_values_spec.rb
444
- - spec/integration/schema/not_spec.rb
445
- - spec/integration/schema/numbers_spec.rb
446
- - spec/integration/schema/option_with_default_spec.rb
447
- - spec/integration/schema/or_spec.rb
448
- - spec/integration/schema/params/defining_base_schema_spec.rb
449
- - spec/integration/schema/params/explicit_types_spec.rb
450
- - spec/integration/schema/params_spec.rb
451
- - spec/integration/schema/predicate_verification_spec.rb
452
- - spec/integration/schema/predicates/array_spec.rb
453
- - spec/integration/schema/predicates/custom_spec.rb
454
- - spec/integration/schema/predicates/empty_spec.rb
455
- - spec/integration/schema/predicates/eql_spec.rb
456
- - spec/integration/schema/predicates/even_spec.rb
457
- - spec/integration/schema/predicates/excluded_from/array_spec.rb
458
- - spec/integration/schema/predicates/excluded_from/range_spec.rb
459
- - spec/integration/schema/predicates/excludes_spec.rb
460
- - spec/integration/schema/predicates/filled_spec.rb
461
- - spec/integration/schema/predicates/format_spec.rb
462
- - spec/integration/schema/predicates/gt_spec.rb
463
- - spec/integration/schema/predicates/gteq_spec.rb
464
- - spec/integration/schema/predicates/hash_spec.rb
465
- - spec/integration/schema/predicates/included_in/array_spec.rb
466
- - spec/integration/schema/predicates/included_in/range_spec.rb
467
- - spec/integration/schema/predicates/includes_spec.rb
468
- - spec/integration/schema/predicates/key_spec.rb
469
- - spec/integration/schema/predicates/lt_spec.rb
470
- - spec/integration/schema/predicates/lteq_spec.rb
471
- - spec/integration/schema/predicates/max_size_spec.rb
472
- - spec/integration/schema/predicates/min_size_spec.rb
473
- - spec/integration/schema/predicates/none_spec.rb
474
- - spec/integration/schema/predicates/not_eql_spec.rb
475
- - spec/integration/schema/predicates/odd_spec.rb
476
- - spec/integration/schema/predicates/size/fixed_spec.rb
477
- - spec/integration/schema/predicates/size/range_spec.rb
478
- - spec/integration/schema/predicates/type_spec.rb
479
- - spec/integration/schema/reusing_schema_spec.rb
480
- - spec/integration/schema/using_types_spec.rb
481
- - spec/integration/schema/validate_spec.rb
482
- - spec/integration/schema/xor_spec.rb
483
- - spec/integration/schema_builders_spec.rb
484
- - spec/integration/schema_spec.rb
485
- - spec/shared/message_compiler.rb
486
- - spec/shared/predicate_helper.rb
487
- - spec/shared/rule_compiler.rb
488
- - spec/spec_helper.rb
489
- - spec/support/define_struct.rb
490
- - spec/support/matchers.rb
491
- - spec/support/mutant.rb
492
- - spec/support/predicates_integration.rb
493
- - spec/unit/input_processor_compiler/json_spec.rb
494
- - spec/unit/input_processor_compiler/params_spec.rb
495
- - spec/unit/message_compiler/visit_failure_spec.rb
496
- - spec/unit/message_compiler/visit_spec.rb
497
- - spec/unit/message_compiler_spec.rb
498
- - spec/unit/predicate_registry_spec.rb
499
- - spec/unit/schema/key_spec.rb
500
- - spec/unit/schema/rule_spec.rb
501
- - spec/unit/schema/value_spec.rb
502
- - spec/unit/schema_spec.rb
211
+ summary: Validation library
212
+ test_files: []