dry-validation 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c0ec5ac402da094ae496a120274c13f2a251300df9b178adb0b688968687082
4
- data.tar.gz: b07231e7542c689d1d02cf2e8de3837592cb7867cc7772c4968034129bb65012
3
+ metadata.gz: 1cbb33c9bad218b481c727b04080736ad0d974f47b552ed305de4f50e5bd8d6d
4
+ data.tar.gz: e464d56a10afa52ab975d44d204a0879649007eeb98a1a15038e5c6d29b78b21
5
5
  SHA512:
6
- metadata.gz: 7d4835f01c7c8e02d63e1583f6e140efb8db33582800c2c276c94865f6841d8533b91b3fd5832944f57ad8e59f7660dcdff930dfe77e0ae17537c18f0caa14c6
7
- data.tar.gz: e8b2cba4863b18461a8f64e6581654aecaca6525b603e40e6896199faecd5a735f8e5d1a8dbd9d6bb1ac43d562d8bb09ff3bbf77cd01d9b21d9cdef8da4f8e36
6
+ metadata.gz: 94637a8714ffc4111c0279a7aeb52613fccf894abd33207600131e7af59803371b044691949c9a457c85bbdbb9d063c7c050aa58fc51966e7469b62f97156008
7
+ data.tar.gz: f15fbb334bd99fe79348a750bca344beff68156394c314f1845307a1b5b2462446117a80e47d0d3eb40108e3042de99744c205a7ffc99ef48bebd179a5fa0299
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 1.8.1 2022-05-28
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Raise an InvalidKeyErrors on substring of valid keys (issue #705 fixed via #706) (@MatElGran)
9
+ - Using `rule(:arr).each { .. }` doesn't crash when `:arr` turns out to be `nil` (issue #708 fixed via #709) (@bautrey37)
10
+
11
+
12
+ [Compare v1.8.0...v1.8.1](https://github.com/dry-rb/dry-validation/compare/v1.8.0...v1.8.1)
13
+
3
14
  ## 1.8.0 2022-02-17
4
15
 
5
16
 
data/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![CI Status](https://github.com/dry-rb/dry-validation/workflows/ci/badge.svg)][actions]
12
12
  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/f30e3ff5ec304c55a73868cdbf055c67)][codacy]
13
13
  [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/f30e3ff5ec304c55a73868cdbf055c67)][codacy]
14
- [![Inline docs](http://inch-ci.org/github/dry-rb/dry-validation.svg?branch=master)][inchpages]
14
+ [![Inline docs](http://inch-ci.org/github/dry-rb/dry-validation.svg?branch=main)][inchpages]
15
15
 
16
16
  ## Links
17
17
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
25
- spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-validation/blob/master/CHANGELOG.md"
25
+ spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-validation/blob/main/CHANGELOG.md"
26
26
  spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-validation"
27
27
  spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-validation/issues"
28
28
 
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_runtime_dependency "dry-container", "~> 0.7", ">= 0.7.1"
34
34
  spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5"
35
35
  spec.add_runtime_dependency "dry-initializer", "~> 3.0"
36
- spec.add_runtime_dependency "dry-schema", "~> 1.9", ">= 1.9.1"
36
+ spec.add_runtime_dependency "dry-schema", "~> 1.8", ">= 1.8.0"
37
37
 
38
38
  spec.add_development_dependency "bundler"
39
39
  spec.add_development_dependency "rake"
@@ -158,11 +158,13 @@ module Dry
158
158
  valid_paths = key_map.to_dot_notation
159
159
  key_paths = key_paths(keys)
160
160
 
161
- invalid_keys = key_paths.map { |(key, path)|
162
- unless valid_paths.any? { |vp| vp.include?(path) || vp.include?("#{path}[]") }
161
+ invalid_keys = key_paths.filter_map { |(key, path)|
162
+ if valid_paths.none? { |vp|
163
+ vp == path || vp.start_with?("#{path}.", "#{path}[]")
164
+ }
163
165
  key
164
166
  end
165
- }.compact.uniq
167
+ }.uniq
166
168
 
167
169
  return if invalid_keys.empty?
168
170
 
@@ -76,13 +76,15 @@ module Dry
76
76
  # @return [Rule]
77
77
  #
78
78
  # @api public
79
+ #
80
+ # rubocop:disable Metrics/AbcSize
79
81
  def each(*macros, &block)
80
82
  root = keys[0]
81
83
  macros = parse_macros(*macros)
82
84
  @keys = []
83
85
 
84
86
  @block = proc do
85
- unless result.base_error?(root) || !values.key?(root)
87
+ unless result.base_error?(root) || !values.key?(root) || values[root].nil?
86
88
  values[root].each_with_index do |_, idx|
87
89
  path = [*Schema::Path[root].to_a, idx]
88
90
 
@@ -99,6 +101,7 @@ module Dry
99
101
 
100
102
  self
101
103
  end
104
+ # rubocop:enable Metrics/AbcSize
102
105
 
103
106
  # Return a nice string representation
104
107
  #
@@ -65,7 +65,6 @@ module Dry
65
65
  def key?(key, hash = data)
66
66
  return hash.key?(key) if key.is_a?(Symbol)
67
67
 
68
- # rubocop: disable Lint/DuplicateBranch
69
68
  Schema::Path[key].reduce(hash) do |a, e|
70
69
  if e.is_a?(Array)
71
70
  result = e.all? { |k| key?(k, a) }
@@ -81,8 +80,6 @@ module Dry
81
80
  end
82
81
  a[e]
83
82
  end
84
- # rubocop: enable Lint/DuplicateBranch
85
-
86
83
  true
87
84
  end
88
85
  # rubocop: enable Metrics/PerceivedComplexity
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Validation
5
- VERSION = "1.8.0"
5
+ VERSION = "1.8.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-17 00:00:00.000000000 Z
11
+ date: 2022-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -84,20 +84,20 @@ dependencies:
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '1.9'
87
+ version: '1.8'
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 1.9.1
90
+ version: 1.8.0
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '1.9'
97
+ version: '1.8'
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: 1.9.1
100
+ version: 1.8.0
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: bundler
103
103
  requirement: !ruby/object:Gem::Requirement
@@ -179,10 +179,10 @@ licenses:
179
179
  - MIT
180
180
  metadata:
181
181
  allowed_push_host: https://rubygems.org
182
- changelog_uri: https://github.com/dry-rb/dry-validation/blob/master/CHANGELOG.md
182
+ changelog_uri: https://github.com/dry-rb/dry-validation/blob/main/CHANGELOG.md
183
183
  source_code_uri: https://github.com/dry-rb/dry-validation
184
184
  bug_tracker_uri: https://github.com/dry-rb/dry-validation/issues
185
- post_install_message:
185
+ post_install_message:
186
186
  rdoc_options: []
187
187
  require_paths:
188
188
  - lib
@@ -197,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.1.6
201
- signing_key:
200
+ rubygems_version: 3.2.32
201
+ signing_key:
202
202
  specification_version: 4
203
203
  summary: Validation library
204
204
  test_files: []