dry-validation 1.4.0 → 1.4.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 +4 -4
- data/CHANGELOG.md +15 -1
- data/LICENSE +1 -1
- data/README.md +9 -10
- data/lib/dry/validation/evaluator.rb +1 -0
- data/lib/dry/validation/extensions/predicates_as_macros.rb +1 -1
- data/lib/dry/validation/messages/resolver.rb +21 -1
- data/lib/dry/validation/result.rb +16 -0
- data/lib/dry/validation/values.rb +1 -0
- data/lib/dry/validation/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7da2738360b969decba415a2a6418b41ca8b55202d39dd6843871722b904164e
|
4
|
+
data.tar.gz: 20cfc387c6ebe8ce8ffd9b6d9227d59393cf304ba70bdd01ace0ff13d67e99fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d86de3a87c58f51dabd171950a3d72398e3a93fde3ac521937c0e7b13518388519238127968eb330b991774a2d017b109e3ddc919e23d423771c2bee6361a63
|
7
|
+
data.tar.gz: 86c6cc8cf5ea0ba31dda616f68cedd2481f9e1f8455d787d4575583af7ad7428cee4de45477bf454084adacd6778216f2867dc95ac0cbe1e9fad2889a07f124a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# v1.4.1 2020-01-08
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- Pattern matching on result values (@flash-gordon)
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
- List tokens are correctly interpolated as a comma separated list in rule messages (see #611) (@waiting-for-dev)
|
10
|
+
- Warnings about delegated keywords (@flash-gordon)
|
11
|
+
- A few delegation warnings about keyword arguments (@flash-gordon)
|
12
|
+
|
13
|
+
[Compare v1.4.0...v1.4.1](https://github.com/dry-rb/dry-validation/compare/v1.4.0...v1.4.1)
|
14
|
+
|
1
15
|
# v1.4.0 2019-12-12
|
2
16
|
|
3
17
|
### Added
|
@@ -16,7 +30,7 @@
|
|
16
30
|
- [internal] improved performance in `Contract.ensure_valid_keys` (@grzegorz-jakubiak)
|
17
31
|
- [internal] fixed keyword warnings on MRI 2.7.0 (@flash-gordon)
|
18
32
|
|
19
|
-
[Compare v1.3.1...
|
33
|
+
[Compare v1.3.1...v1.4.0](https://github.com/dry-rb/dry-validation/compare/v1.3.1...v1.4.0)
|
20
34
|
|
21
35
|
# v1.3.1 2019-08-16
|
22
36
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
[gem]: https://rubygems.org/gems/dry-validation
|
2
|
-
[
|
3
|
-
[
|
2
|
+
[actions]: https://github.com/dry-rb/dry-validation/actions
|
3
|
+
[codacy]: https://www.codacy.com/gh/dry-rb/dry-validation
|
4
4
|
[chat]: https://dry-rb.zulipchat.com
|
5
5
|
[inchpages]: http://inch-ci.org/github/dry-rb/dry-validation
|
6
6
|
|
7
7
|
# dry-validation [][chat]
|
8
8
|
|
9
9
|
[][gem]
|
10
|
-
[][actions]
|
11
|
+
[][codacy]
|
12
|
+
[][codacy]
|
13
13
|
[][inchpages]
|
14
14
|
|
15
15
|
## Links
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
- [Guidelines for contributing](CONTRIBUTING.md)
|
17
|
+
* [User documentation](http://dry-rb.org/gems/dry-validation)
|
18
|
+
* [API documentation](http://rubydoc.info/gems/dry-validation)
|
20
19
|
|
21
20
|
## Supported Ruby versions
|
22
21
|
|
23
22
|
This library officially supports the following Ruby versions:
|
24
23
|
|
25
|
-
|
26
|
-
|
24
|
+
* MRI >= `2.4`
|
25
|
+
* jruby >= `9.2`
|
27
26
|
|
28
27
|
## License
|
29
28
|
|
@@ -12,7 +12,7 @@ module Dry
|
|
12
12
|
#
|
13
13
|
# @see Dry::Validation::Contract
|
14
14
|
WHITELIST = %i[
|
15
|
-
filled? gt? gteq? included_in? includes? inclusion? is? lt?
|
15
|
+
filled? format? gt? gteq? included_in? includes? inclusion? is? lt?
|
16
16
|
lteq? max_size? min_size? not_eql? odd? respond_to? size? true?
|
17
17
|
uuid_v4?
|
18
18
|
].freeze
|
@@ -75,11 +75,31 @@ module Dry
|
|
75
75
|
STR
|
76
76
|
end
|
77
77
|
|
78
|
-
|
78
|
+
parsed_tokens = parse_tokens(tokens)
|
79
|
+
text = template.(template.data(parsed_tokens))
|
79
80
|
|
80
81
|
[full ? "#{messages.rule(keys.last, msg_opts)} #{text}" : text, meta]
|
81
82
|
end
|
82
83
|
# rubocop:enable Metrics/AbcSize
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def parse_tokens(tokens)
|
88
|
+
Hash[
|
89
|
+
tokens.map do |key, token|
|
90
|
+
[key, parse_token(token)]
|
91
|
+
end
|
92
|
+
]
|
93
|
+
end
|
94
|
+
|
95
|
+
def parse_token(token)
|
96
|
+
case token
|
97
|
+
when Array
|
98
|
+
token.join(', ')
|
99
|
+
else
|
100
|
+
token
|
101
|
+
end
|
102
|
+
end
|
83
103
|
end
|
84
104
|
end
|
85
105
|
end
|
@@ -179,6 +179,22 @@ module Dry
|
|
179
179
|
super
|
180
180
|
end
|
181
181
|
|
182
|
+
if RUBY_VERSION >= '2.7'
|
183
|
+
# Pattern matching
|
184
|
+
#
|
185
|
+
# @api private
|
186
|
+
def deconstruct_keys(keys)
|
187
|
+
values.deconstruct_keys(keys)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Pattern matching
|
191
|
+
#
|
192
|
+
# @api private
|
193
|
+
def deconstruct
|
194
|
+
[values, context.each.to_h]
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
182
198
|
private
|
183
199
|
|
184
200
|
# @api private
|
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.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
version: '1.0'
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 1.3
|
98
|
+
version: 1.4.3
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -105,7 +105,7 @@ dependencies:
|
|
105
105
|
version: '1.0'
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 1.3
|
108
|
+
version: 1.4.3
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: bundler
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
|
-
rubygems_version: 3.
|
203
|
+
rubygems_version: 3.1.2
|
204
204
|
signing_key:
|
205
205
|
specification_version: 4
|
206
206
|
summary: Validation library
|