dry-validation 0.13.3 → 1.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -25
  3. data/LICENSE +1 -1
  4. data/README.md +9 -4
  5. data/lib/dry-validation.rb +2 -0
  6. data/lib/dry/validation.rb +8 -35
  7. data/lib/dry/validation/constants.rb +12 -0
  8. data/lib/dry/validation/contract.rb +132 -0
  9. data/lib/dry/validation/contract/class_interface.rb +114 -0
  10. data/lib/dry/validation/evaluator.rb +121 -0
  11. data/lib/dry/validation/extensions/monads.rb +23 -7
  12. data/lib/dry/validation/messages.rb +50 -6
  13. data/lib/dry/validation/result.rb +109 -45
  14. data/lib/dry/validation/rule.rb +37 -0
  15. data/lib/dry/validation/version.rb +3 -1
  16. metadata +36 -337
  17. data/.codeclimate.yml +0 -17
  18. data/.gitignore +0 -9
  19. data/.rspec +0 -3
  20. data/.travis.yml +0 -29
  21. data/CONTRIBUTING.md +0 -31
  22. data/Gemfile +0 -25
  23. data/Rakefile +0 -22
  24. data/benchmarks/benchmark_form_invalid.rb +0 -64
  25. data/benchmarks/benchmark_form_valid.rb +0 -64
  26. data/benchmarks/benchmark_schema_invalid_huge.rb +0 -52
  27. data/benchmarks/profile_schema_call_invalid.rb +0 -20
  28. data/benchmarks/profile_schema_call_valid.rb +0 -20
  29. data/benchmarks/profile_schema_definition.rb +0 -14
  30. data/benchmarks/profile_schema_huge_invalid.rb +0 -30
  31. data/benchmarks/profile_schema_messages_invalid.rb +0 -20
  32. data/benchmarks/suite.rb +0 -5
  33. data/config/errors.yml +0 -89
  34. data/dry-validation.gemspec +0 -28
  35. data/examples/basic.rb +0 -15
  36. data/examples/each.rb +0 -14
  37. data/examples/json.rb +0 -12
  38. data/examples/multiple.rb +0 -27
  39. data/examples/nested.rb +0 -22
  40. data/examples/params.rb +0 -11
  41. data/lib/dry/validation/compat/form.rb +0 -67
  42. data/lib/dry/validation/deprecations.rb +0 -24
  43. data/lib/dry/validation/executor.rb +0 -91
  44. data/lib/dry/validation/extensions.rb +0 -7
  45. data/lib/dry/validation/extensions/struct.rb +0 -32
  46. data/lib/dry/validation/input_processor_compiler.rb +0 -137
  47. data/lib/dry/validation/input_processor_compiler/json.rb +0 -45
  48. data/lib/dry/validation/input_processor_compiler/params.rb +0 -49
  49. data/lib/dry/validation/input_processor_compiler/sanitizer.rb +0 -47
  50. data/lib/dry/validation/message.rb +0 -98
  51. data/lib/dry/validation/message_compiler.rb +0 -188
  52. data/lib/dry/validation/message_compiler/visitor_opts.rb +0 -37
  53. data/lib/dry/validation/message_set.rb +0 -122
  54. data/lib/dry/validation/messages/abstract.rb +0 -119
  55. data/lib/dry/validation/messages/i18n.rb +0 -47
  56. data/lib/dry/validation/messages/namespaced.rb +0 -39
  57. data/lib/dry/validation/messages/yaml.rb +0 -61
  58. data/lib/dry/validation/predicate_registry.rb +0 -115
  59. data/lib/dry/validation/predicates.rb +0 -19
  60. data/lib/dry/validation/schema.rb +0 -126
  61. data/lib/dry/validation/schema/check.rb +0 -37
  62. data/lib/dry/validation/schema/class_interface.rb +0 -190
  63. data/lib/dry/validation/schema/deprecated.rb +0 -30
  64. data/lib/dry/validation/schema/dsl.rb +0 -118
  65. data/lib/dry/validation/schema/form.rb +0 -9
  66. data/lib/dry/validation/schema/json.rb +0 -21
  67. data/lib/dry/validation/schema/key.rb +0 -71
  68. data/lib/dry/validation/schema/params.rb +0 -22
  69. data/lib/dry/validation/schema/rule.rb +0 -202
  70. data/lib/dry/validation/schema/value.rb +0 -211
  71. data/lib/dry/validation/schema_compiler.rb +0 -81
  72. data/lib/dry/validation/template.rb +0 -66
  73. data/lib/dry/validation/type_specs.rb +0 -70
  74. data/spec/extensions/monads/result_spec.rb +0 -40
  75. data/spec/extensions/struct/schema_spec.rb +0 -32
  76. data/spec/fixtures/locales/en.yml +0 -8
  77. data/spec/fixtures/locales/pl.yml +0 -22
  78. data/spec/integration/custom_error_messages_spec.rb +0 -54
  79. data/spec/integration/custom_predicates_spec.rb +0 -228
  80. data/spec/integration/hints_spec.rb +0 -170
  81. data/spec/integration/injecting_rules_spec.rb +0 -30
  82. data/spec/integration/json/defining_base_schema_spec.rb +0 -41
  83. data/spec/integration/localized_error_messages_spec.rb +0 -72
  84. data/spec/integration/message_compiler_spec.rb +0 -405
  85. data/spec/integration/messages/i18n_spec.rb +0 -104
  86. data/spec/integration/optional_keys_spec.rb +0 -28
  87. data/spec/integration/params/predicates/array_spec.rb +0 -287
  88. data/spec/integration/params/predicates/empty_spec.rb +0 -263
  89. data/spec/integration/params/predicates/eql_spec.rb +0 -327
  90. data/spec/integration/params/predicates/even_spec.rb +0 -455
  91. data/spec/integration/params/predicates/excluded_from_spec.rb +0 -455
  92. data/spec/integration/params/predicates/excludes_spec.rb +0 -391
  93. data/spec/integration/params/predicates/false_spec.rb +0 -455
  94. data/spec/integration/params/predicates/filled_spec.rb +0 -467
  95. data/spec/integration/params/predicates/format_spec.rb +0 -454
  96. data/spec/integration/params/predicates/gt_spec.rb +0 -519
  97. data/spec/integration/params/predicates/gteq_spec.rb +0 -519
  98. data/spec/integration/params/predicates/included_in_spec.rb +0 -455
  99. data/spec/integration/params/predicates/includes_spec.rb +0 -391
  100. data/spec/integration/params/predicates/key_spec.rb +0 -67
  101. data/spec/integration/params/predicates/lt_spec.rb +0 -519
  102. data/spec/integration/params/predicates/lteq_spec.rb +0 -519
  103. data/spec/integration/params/predicates/max_size_spec.rb +0 -391
  104. data/spec/integration/params/predicates/min_size_spec.rb +0 -391
  105. data/spec/integration/params/predicates/none_spec.rb +0 -265
  106. data/spec/integration/params/predicates/not_eql_spec.rb +0 -327
  107. data/spec/integration/params/predicates/odd_spec.rb +0 -455
  108. data/spec/integration/params/predicates/size/fixed_spec.rb +0 -393
  109. data/spec/integration/params/predicates/size/range_spec.rb +0 -396
  110. data/spec/integration/params/predicates/true_spec.rb +0 -455
  111. data/spec/integration/params/predicates/type_spec.rb +0 -391
  112. data/spec/integration/result_spec.rb +0 -81
  113. data/spec/integration/schema/array_schema_spec.rb +0 -59
  114. data/spec/integration/schema/check_rules_spec.rb +0 -119
  115. data/spec/integration/schema/check_with_nested_el_spec.rb +0 -37
  116. data/spec/integration/schema/check_with_nth_el_spec.rb +0 -25
  117. data/spec/integration/schema/default_settings_spec.rb +0 -11
  118. data/spec/integration/schema/defining_base_schema_spec.rb +0 -41
  119. data/spec/integration/schema/dynamic_predicate_args_spec.rb +0 -43
  120. data/spec/integration/schema/each_with_set_spec.rb +0 -70
  121. data/spec/integration/schema/extending_dsl_spec.rb +0 -27
  122. data/spec/integration/schema/form_spec.rb +0 -236
  123. data/spec/integration/schema/hash_schema_spec.rb +0 -47
  124. data/spec/integration/schema/inheriting_schema_spec.rb +0 -31
  125. data/spec/integration/schema/input_processor_spec.rb +0 -46
  126. data/spec/integration/schema/json/explicit_types_spec.rb +0 -157
  127. data/spec/integration/schema/json_spec.rb +0 -163
  128. data/spec/integration/schema/macros/confirmation_spec.rb +0 -35
  129. data/spec/integration/schema/macros/each_spec.rb +0 -268
  130. data/spec/integration/schema/macros/filled_spec.rb +0 -87
  131. data/spec/integration/schema/macros/input_spec.rb +0 -139
  132. data/spec/integration/schema/macros/maybe_spec.rb +0 -99
  133. data/spec/integration/schema/macros/rule_spec.rb +0 -75
  134. data/spec/integration/schema/macros/value_spec.rb +0 -119
  135. data/spec/integration/schema/macros/when_spec.rb +0 -62
  136. data/spec/integration/schema/nested_schemas_spec.rb +0 -236
  137. data/spec/integration/schema/nested_values_spec.rb +0 -46
  138. data/spec/integration/schema/not_spec.rb +0 -34
  139. data/spec/integration/schema/numbers_spec.rb +0 -19
  140. data/spec/integration/schema/option_with_default_spec.rb +0 -64
  141. data/spec/integration/schema/or_spec.rb +0 -87
  142. data/spec/integration/schema/params/defining_base_schema_spec.rb +0 -41
  143. data/spec/integration/schema/params/explicit_types_spec.rb +0 -195
  144. data/spec/integration/schema/params_spec.rb +0 -234
  145. data/spec/integration/schema/predicate_verification_spec.rb +0 -9
  146. data/spec/integration/schema/predicates/array_spec.rb +0 -295
  147. data/spec/integration/schema/predicates/custom_spec.rb +0 -103
  148. data/spec/integration/schema/predicates/empty_spec.rb +0 -263
  149. data/spec/integration/schema/predicates/eql_spec.rb +0 -327
  150. data/spec/integration/schema/predicates/even_spec.rb +0 -455
  151. data/spec/integration/schema/predicates/excluded_from/array_spec.rb +0 -459
  152. data/spec/integration/schema/predicates/excluded_from/range_spec.rb +0 -459
  153. data/spec/integration/schema/predicates/excludes_spec.rb +0 -391
  154. data/spec/integration/schema/predicates/filled_spec.rb +0 -467
  155. data/spec/integration/schema/predicates/format_spec.rb +0 -455
  156. data/spec/integration/schema/predicates/gt_spec.rb +0 -519
  157. data/spec/integration/schema/predicates/gteq_spec.rb +0 -519
  158. data/spec/integration/schema/predicates/hash_spec.rb +0 -69
  159. data/spec/integration/schema/predicates/included_in/array_spec.rb +0 -459
  160. data/spec/integration/schema/predicates/included_in/range_spec.rb +0 -459
  161. data/spec/integration/schema/predicates/includes_spec.rb +0 -391
  162. data/spec/integration/schema/predicates/key_spec.rb +0 -88
  163. data/spec/integration/schema/predicates/lt_spec.rb +0 -520
  164. data/spec/integration/schema/predicates/lteq_spec.rb +0 -519
  165. data/spec/integration/schema/predicates/max_size_spec.rb +0 -391
  166. data/spec/integration/schema/predicates/min_size_spec.rb +0 -391
  167. data/spec/integration/schema/predicates/none_spec.rb +0 -265
  168. data/spec/integration/schema/predicates/not_eql_spec.rb +0 -391
  169. data/spec/integration/schema/predicates/odd_spec.rb +0 -455
  170. data/spec/integration/schema/predicates/size/fixed_spec.rb +0 -398
  171. data/spec/integration/schema/predicates/size/range_spec.rb +0 -395
  172. data/spec/integration/schema/predicates/type_spec.rb +0 -413
  173. data/spec/integration/schema/reusing_schema_spec.rb +0 -33
  174. data/spec/integration/schema/using_types_spec.rb +0 -135
  175. data/spec/integration/schema/validate_spec.rb +0 -120
  176. data/spec/integration/schema/xor_spec.rb +0 -35
  177. data/spec/integration/schema_builders_spec.rb +0 -17
  178. data/spec/integration/schema_spec.rb +0 -173
  179. data/spec/shared/message_compiler.rb +0 -11
  180. data/spec/shared/predicate_helper.rb +0 -15
  181. data/spec/shared/rule_compiler.rb +0 -8
  182. data/spec/spec_helper.rb +0 -62
  183. data/spec/support/define_struct.rb +0 -25
  184. data/spec/support/matchers.rb +0 -38
  185. data/spec/support/mutant.rb +0 -9
  186. data/spec/support/predicates_integration.rb +0 -7
  187. data/spec/unit/input_processor_compiler/json_spec.rb +0 -283
  188. data/spec/unit/input_processor_compiler/params_spec.rb +0 -328
  189. data/spec/unit/message_compiler/visit_failure_spec.rb +0 -38
  190. data/spec/unit/message_compiler/visit_spec.rb +0 -16
  191. data/spec/unit/message_compiler_spec.rb +0 -7
  192. data/spec/unit/predicate_registry_spec.rb +0 -34
  193. data/spec/unit/schema/key_spec.rb +0 -38
  194. data/spec/unit/schema/rule_spec.rb +0 -42
  195. data/spec/unit/schema/value_spec.rb +0 -131
  196. data/spec/unit/schema_spec.rb +0 -35
@@ -1,18 +1,34 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/monads/result'
2
4
 
3
5
  module Dry
4
6
  module Validation
7
+ # Monad extension for contract results
8
+ #
9
+ # @example
10
+ # Dry::Validation.load_extensions(:monads)
11
+ #
12
+ # contract = Dry::Validation::Contract.build do
13
+ # schema do
14
+ # required(:name).filled(:string)
15
+ # end
16
+ # end
17
+ #
18
+ # contract.call(name: nil).to_monad
19
+ #
20
+ # @api public
5
21
  class Result
6
22
  include Dry::Monads::Result::Mixin
7
23
 
8
- def to_monad(options = EMPTY_HASH)
9
- if success?
10
- Success(output)
11
- else
12
- Failure(messages(options))
13
- end
24
+ # Returns a result monad
25
+ #
26
+ # @return [Dry::Monads::Result]
27
+ #
28
+ # @api public
29
+ def to_monad
30
+ success? ? Success(to_h) : Failure(self)
14
31
  end
15
- alias_method :to_either, :to_monad
16
32
  end
17
33
  end
18
34
  end
@@ -1,14 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/schema/messages'
4
+
1
5
  module Dry
2
6
  module Validation
3
7
  module Messages
8
+ class YAML < Schema::Messages::YAML
9
+ config.root = config.root.gsub('dry_schema', 'dry_validation')
10
+ config.rule_lookup_paths = config.rule_lookup_paths.map { |path|
11
+ path.gsub('dry_schema', 'dry_validation')
12
+ }
13
+ end
14
+
15
+ if defined?(::I18n)
16
+ class I18n < Schema::Messages::I18n
17
+ config.root = config.root.gsub('dry_schema', 'dry_validation')
18
+ config.rule_lookup_paths = config.rule_lookup_paths.map { |path|
19
+ path.gsub('dry_schema', 'dry_validation')
20
+ }
21
+ end
22
+ end
23
+
24
+ # @api private
25
+ def self.setup(config)
26
+ messages = build(config)
27
+
28
+ if config.messages_file && config.namespace
29
+ messages.merge(config.messages_file).namespaced(config.namespace)
30
+ elsif config.messages_file
31
+ messages.merge(config.messages_file)
32
+ elsif config.namespace
33
+ messages.namespaced(config.namespace)
34
+ else
35
+ messages
36
+ end
37
+ end
38
+
39
+ # @api private
40
+ def self.build(config)
41
+ klass =
42
+ case config.messages
43
+ when :yaml then default
44
+ when :i18n then Messages::I18n
45
+ else
46
+ raise "+#{config.messages}+ is not a valid messages identifier"
47
+ end
48
+
49
+ klass.build
50
+ end
51
+
52
+ # @api private
4
53
  def self.default
5
- Messages::YAML.load
54
+ Messages::YAML
6
55
  end
7
56
  end
8
57
  end
9
58
  end
10
-
11
- require 'dry/validation/messages/abstract'
12
- require 'dry/validation/messages/namespaced'
13
- require 'dry/validation/messages/yaml'
14
- require 'dry/validation/messages/i18n' if defined?(I18n)
@@ -1,82 +1,146 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dry/equalizer'
4
+ require 'dry/validation/constants'
2
5
 
3
6
  module Dry
4
7
  module Validation
8
+ # Result objects are returned by contracts
9
+ #
10
+ # @api public
5
11
  class Result
6
- include Dry::Equalizer(:output, :errors)
7
- include Enumerable
8
-
9
- attr_reader :output
10
- attr_reader :results
11
- attr_reader :message_compiler
12
- attr_reader :path
13
-
14
- alias_method :to_hash, :output
15
- alias_method :to_h, :output # for MRI 2.0, remove it when drop support
16
-
17
- def initialize(output, results, message_compiler, path)
18
- @output = output
19
- @results = results
20
- @message_compiler = message_compiler
21
- @path = path
12
+ include Dry::Equalizer(:values, :errors)
13
+
14
+ # Build a new result
15
+ #
16
+ # @api private
17
+ def self.new(params, errors = EMPTY_HASH.dup)
18
+ result = super
19
+ yield(result) if block_given?
20
+ result.freeze
22
21
  end
23
22
 
24
- def each(&block)
25
- output.each(&block)
23
+ # @!attribute [r] values
24
+ # @return [Dry::Schema::Result]
25
+ # @api private
26
+ attr_reader :values
27
+
28
+ # @!attribute [r] errors
29
+ # @return [Hash<Symbol=>Array<String>>]
30
+ # @api public
31
+ attr_reader :errors
32
+
33
+ # Initialize a new result
34
+ #
35
+ # @api private
36
+ def initialize(values, errors)
37
+ @values = values
38
+ @errors = errors.update(values.errors)
26
39
  end
27
40
 
28
- def [](name)
29
- output.fetch(name)
41
+ # Return all messages including hints from schema
42
+ #
43
+ # @api public
44
+ def messages
45
+ values.messages
30
46
  end
31
47
 
48
+ # Check if result is successful
49
+ #
50
+ # @return [Bool]
51
+ #
52
+ # @api public
32
53
  def success?
33
- results.empty?
54
+ errors.empty?
34
55
  end
35
56
 
57
+ # Check if result is not successful
58
+ #
59
+ # @return [Bool]
60
+ #
61
+ # @api public
36
62
  def failure?
37
63
  !success?
38
64
  end
39
65
 
40
- def messages(options = EMPTY_HASH)
41
- message_set(options).dump
66
+ # Check if values include an error for the provided key
67
+ #
68
+ # @api private
69
+ def error?(key)
70
+ values.error?(key)
42
71
  end
43
72
 
44
- def errors(options = EMPTY_HASH)
45
- message_set(options.merge(hints: false)).dump
73
+ # Add a new error for the provided key
74
+ #
75
+ # @api private
76
+ def add_error(key, message)
77
+ (errors[key] ||= EMPTY_ARRAY.dup) << message
78
+ self
46
79
  end
47
80
 
48
- def hints(options = EMPTY_HASH)
49
- message_set(options.merge(failures: false)).dump
81
+ # Read a value under provided key
82
+ #
83
+ # @param [Symbol] key
84
+ #
85
+ # @return [Object]
86
+ #
87
+ # @api public
88
+ def [](key)
89
+ values.key?(key) && values[key] || storage.key?(key) && storage[key]
50
90
  end
51
91
 
52
- def message_set(options = EMPTY_HASH)
53
- message_compiler.with(options).(result_ast)
92
+ # Store value under specified key
93
+ #
94
+ # @param [Symbol] key
95
+ # @param [Object] value
96
+ #
97
+ # @return [Object]
98
+ #
99
+ # @api public
100
+ def []=(key, value)
101
+ raise ArgumentError, "Key +#{key}+ was already set" if key?(key)
102
+
103
+ storage[key] = value
54
104
  end
55
105
 
56
- def to_ast
57
- if name
58
- [type, [name, [:set, result_ast]]]
59
- else
60
- ast
61
- end
106
+ # Check if a key was set
107
+ #
108
+ # @param [Symbol] key
109
+ #
110
+ # @return [Bool]
111
+ #
112
+ # @api public
113
+ def key?(key)
114
+ values.key?(key) || storage.key?(key)
62
115
  end
63
116
 
64
- def ast(*)
65
- [:set, result_ast]
117
+ # Coerce to a hash
118
+ #
119
+ # @api public
120
+ def to_h
121
+ values.to_h
66
122
  end
123
+ alias_method :to_hash, :to_h
67
124
 
68
- def name
69
- Array(path).last
125
+ # Add new errors
126
+ #
127
+ # @api private
128
+ def update(new_errors)
129
+ errors.update(new_errors)
70
130
  end
71
131
 
72
- private
73
-
74
- def type
75
- success? ? :success : :failure
132
+ # Return a string representation
133
+ #
134
+ # @api public
135
+ def inspect
136
+ "#<#{self.class}#{to_h.inspect} errors=#{errors.inspect}>"
76
137
  end
77
138
 
78
- def result_ast
79
- @result_ast ||= results.map(&:to_ast)
139
+ private
140
+
141
+ # @api private
142
+ def storage
143
+ @storage ||= EMPTY_HASH.dup
80
144
  end
81
145
  end
82
146
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/equalizer'
4
+ require 'dry/initializer'
5
+
6
+ module Dry
7
+ module Validation
8
+ # Rules are created by contracts
9
+ #
10
+ # @api private
11
+ class Rule
12
+ include Dry::Equalizer(:name, :block)
13
+
14
+ extend Dry::Initializer
15
+
16
+ # @!atrribute [r] keys
17
+ # @return [Array<Symbol, String, Hash>]
18
+ # @api private
19
+ option :keys
20
+
21
+ # @!atrribute [r] block
22
+ # @return [Proc]
23
+ # @api private
24
+ option :block
25
+
26
+ # Evaluate the rule within the provided context
27
+ #
28
+ # @param [Contract] context
29
+ # @param [Object] values
30
+ #
31
+ # @api private
32
+ def call(context, values)
33
+ Evaluator.new(context, values: values, keys: keys, &block)
34
+ end
35
+ end
36
+ end
37
+ 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.0.0.alpha1'.freeze
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.0.0.alpha1
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: 2019-03-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: concurrent-ruby
@@ -46,12 +45,15 @@ dependencies:
46
45
  - !ruby/object:Gem::Version
47
46
  version: 0.1.3
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
53
  version: '0.2'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.2.1
55
57
  type: :runtime
56
58
  prerelease: false
57
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -59,60 +61,57 @@ dependencies:
59
61
  - - "~>"
60
62
  - !ruby/object:Gem::Version
61
63
  version: '0.2'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 0.2.1
62
67
  - !ruby/object:Gem::Dependency
63
- name: dry-logic
68
+ name: dry-equalizer
64
69
  requirement: !ruby/object:Gem::Requirement
65
70
  requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: 0.5.0
69
71
  - - "~>"
70
72
  - !ruby/object:Gem::Version
71
- version: '0.5'
73
+ version: '0.2'
72
74
  type: :runtime
73
75
  prerelease: false
74
76
  version_requirements: !ruby/object:Gem::Requirement
75
77
  requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: 0.5.0
79
78
  - - "~>"
80
79
  - !ruby/object:Gem::Version
81
- version: '0.5'
80
+ version: '0.2'
82
81
  - !ruby/object:Gem::Dependency
83
- name: dry-types
82
+ name: dry-initializer
84
83
  requirement: !ruby/object:Gem::Requirement
85
84
  requirements:
86
85
  - - "~>"
87
86
  - !ruby/object:Gem::Version
88
- version: 0.14.0
87
+ version: '2.5'
89
88
  type: :runtime
90
89
  prerelease: false
91
90
  version_requirements: !ruby/object:Gem::Requirement
92
91
  requirements:
93
92
  - - "~>"
94
93
  - !ruby/object:Gem::Version
95
- version: 0.14.0
94
+ version: '2.5'
96
95
  - !ruby/object:Gem::Dependency
97
- name: dry-core
96
+ name: dry-schema
98
97
  requirement: !ruby/object:Gem::Requirement
99
98
  requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '0.2'
103
99
  - - ">="
104
100
  - !ruby/object:Gem::Version
105
- version: 0.2.1
101
+ version: '0.3'
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.3'
106
105
  type: :runtime
107
106
  prerelease: false
108
107
  version_requirements: !ruby/object:Gem::Requirement
109
108
  requirements:
110
- - - "~>"
111
- - !ruby/object:Gem::Version
112
- version: '0.2'
113
109
  - - ">="
114
110
  - !ruby/object:Gem::Version
115
- version: 0.2.1
111
+ version: '0.3'
112
+ - - "~>"
113
+ - !ruby/object:Gem::Version
114
+ version: '0.3'
116
115
  - !ruby/object:Gem::Dependency
117
116
  name: bundler
118
117
  requirement: !ruby/object:Gem::Requirement
@@ -157,203 +156,26 @@ dependencies:
157
156
  version: '0'
158
157
  description:
159
158
  email:
160
- - andyholland1991@aol.com
161
159
  - piotr.solnica@gmail.com
162
160
  executables: []
163
161
  extensions: []
164
162
  extra_rdoc_files: []
165
163
  files:
166
- - ".codeclimate.yml"
167
- - ".gitignore"
168
- - ".rspec"
169
- - ".travis.yml"
170
164
  - CHANGELOG.md
171
- - CONTRIBUTING.md
172
- - Gemfile
173
165
  - LICENSE
174
166
  - 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
- - config/errors.yml
186
- - 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
167
  - lib/dry-validation.rb
194
168
  - 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
169
+ - lib/dry/validation/constants.rb
170
+ - lib/dry/validation/contract.rb
171
+ - lib/dry/validation/contract/class_interface.rb
172
+ - lib/dry/validation/evaluator.rb
199
173
  - 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
205
- - lib/dry/validation/message.rb
206
- - lib/dry/validation/message_compiler.rb
207
- - lib/dry/validation/message_compiler/visitor_opts.rb
208
- - lib/dry/validation/message_set.rb
209
174
  - 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
216
175
  - 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
176
+ - lib/dry/validation/rule.rb
231
177
  - 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
178
+ homepage: https://dry-rb.org/gems/dry-validation
357
179
  licenses:
358
180
  - MIT
359
181
  metadata: {}
@@ -365,138 +187,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
365
187
  requirements:
366
188
  - - ">="
367
189
  - !ruby/object:Gem::Version
368
- version: 2.4.0
190
+ version: '2.3'
369
191
  required_rubygems_version: !ruby/object:Gem::Requirement
370
192
  requirements:
371
- - - ">="
193
+ - - ">"
372
194
  - !ruby/object:Gem::Version
373
- version: '0'
195
+ version: 1.3.1
374
196
  requirements: []
375
- rubygems_version: 3.0.3
197
+ rubygems_version: 3.0.1
376
198
  signing_key:
377
199
  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
200
+ summary: Validation library
201
+ test_files: []