dry-schema 1.5.1 → 1.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/dry/schema/message_compiler.rb +18 -2
- data/lib/dry/schema/result.rb +1 -1
- data/lib/dry/schema/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56d8ad72225fe97e2b15ab143007eb6ffc9356a5255bb58392e62e515faec939
|
4
|
+
data.tar.gz: f1c083ba766e4626d6f3b6bba1d90b94c5a69c3876b27c102188a41d48c6882a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456412163fc86f80ccf4f5c03e89801baeb28cc048d1ba510ca99539cbbf8ae512b6ac1e3821399b9121eec007927176f83450b1b4643feb6b3848b3b5c04c1d
|
7
|
+
data.tar.gz: 993d886c1863a36c20d16b2ac7c08ece0412c9e9d97534aea93564f5be02da1772c803115eaef06731f45093ed147ce0ed889578114fc086e9e3d75fd67bd750
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 1.5.2 2020-06-26
|
2
|
+
|
3
|
+
|
4
|
+
### Fixed
|
5
|
+
|
6
|
+
- `Result#{success?,failure?}` work as expected when there are only key validation failures (issue #297 fixed via #298) (@adamransom)
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
|
10
|
+
- Using `full` option no longer adds a space between the name of a key and the message in case of languages that have no spaces between words (ie Japanese) (issue #161 closed via #292 by @tadeusz-niemiec)
|
11
|
+
|
12
|
+
[Compare v1.5.1...v1.5.2](https://github.com/dry-rb/dry-schema/compare/v1.5.1...v1.5.2)
|
13
|
+
|
1
14
|
## 1.5.1 2020-05-21
|
2
15
|
|
3
16
|
|
@@ -29,6 +29,14 @@ module Dry
|
|
29
29
|
|
30
30
|
EMPTY_OPTS = VisitorOpts.new
|
31
31
|
EMPTY_MESSAGE_SET = MessageSet.new(EMPTY_ARRAY).freeze
|
32
|
+
FULL_MESSAGE_WHITESPACE = Hash.new(' ').merge(
|
33
|
+
ja: '',
|
34
|
+
zh: '',
|
35
|
+
bn: '',
|
36
|
+
th: '',
|
37
|
+
lo: '',
|
38
|
+
my: '',
|
39
|
+
)
|
32
40
|
|
33
41
|
param :messages
|
34
42
|
|
@@ -203,12 +211,12 @@ module Dry
|
|
203
211
|
return text if !text || !full
|
204
212
|
|
205
213
|
rule = options[:path]
|
206
|
-
|
214
|
+
[messages.rule(rule, options) || rule, text].join(FULL_MESSAGE_WHITESPACE[template.options[:locale]])
|
207
215
|
end
|
208
216
|
|
209
217
|
# @api private
|
210
218
|
def message_tokens(args)
|
211
|
-
args.each_with_object({}) do |arg, hash|
|
219
|
+
tokens = args.each_with_object({}) do |arg, hash|
|
212
220
|
case arg[1]
|
213
221
|
when Array
|
214
222
|
hash[arg[0]] = arg[1].join(LIST_SEPARATOR)
|
@@ -219,6 +227,14 @@ module Dry
|
|
219
227
|
hash[arg[0]] = arg[1]
|
220
228
|
end
|
221
229
|
end
|
230
|
+
args.any? { |e| e.first == :size } ? append_mapped_size_tokens(tokens) : tokens
|
231
|
+
end
|
232
|
+
|
233
|
+
# @api private
|
234
|
+
def append_mapped_size_tokens(tokens)
|
235
|
+
# this is a temporary fix for the inconsistency in the "size" errors arguments
|
236
|
+
mapped_hash = tokens.each_with_object({}) { |(k, v), h| h[k.to_s.gsub("size", "num").to_sym] = v }
|
237
|
+
tokens.merge(mapped_hash)
|
222
238
|
end
|
223
239
|
end
|
224
240
|
end
|
data/lib/dry/schema/result.rb
CHANGED
data/lib/dry/schema/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|