data-validator 1.1.2 → 1.1.3
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 +5 -5
- data/lib/data/validator.rb +2 -0
- data/lib/data/validator/version.rb +1 -1
- data/test/02_validate_requires_allowextra.rb +30 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 50f3566cc5d434fa1877142a1ce9e993277f3a0d617d2030be78ae801c96113c
|
4
|
+
data.tar.gz: 18949992ca7ee9ced52cf8fc13db55c8689c37f59655f1ae10af4ee88ea52196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e872ba1fb97cd0ed444735cb5f2d53b21f25c6673b51e31adc630dd5a47d93d0d2a457d0b8190042b5d8daa6999abff29cd066b203f3705c108cdc7446bf8822
|
7
|
+
data.tar.gz: e90c0de40e03bcf5937cba724f322f99f66f0e8dd3d9a721aa7e3719008f923402fcba83fb59cccfb0a41f1bbfb5e0e32476e5778a317a0621efa9496041e689
|
data/lib/data/validator.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test-unit'
|
2
|
+
require 'data/validator'
|
3
|
+
|
4
|
+
class Test02Validate < Test::Unit::TestCase
|
5
|
+
test 'requires with AllowExtra' do
|
6
|
+
rule = Data::Validator::Recursive.new(
|
7
|
+
'foo' => String,
|
8
|
+
'bar' => { isa: Integer, default: 1 },
|
9
|
+
'baz' => {
|
10
|
+
isa: Hash,
|
11
|
+
with: 'AllowExtra',
|
12
|
+
rule: {
|
13
|
+
'hoge' => { isa: String }, # requires
|
14
|
+
'fuga' => Integer,
|
15
|
+
},
|
16
|
+
},
|
17
|
+
).with('AllowExtra')
|
18
|
+
|
19
|
+
input = {
|
20
|
+
'foo' => 'xxx',
|
21
|
+
'baz' => {
|
22
|
+
'fuga' => 123,
|
23
|
+
'extra_param_in_baz' => 1,
|
24
|
+
},
|
25
|
+
'extra_param' => 1,
|
26
|
+
}
|
27
|
+
|
28
|
+
assert_raise_message(/missing/) { rule.validate(input) }
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urabe, Shyouhei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/data/validator/recursive.rb
|
128
128
|
- lib/data/validator/version.rb
|
129
129
|
- test/01_orclass.rb
|
130
|
+
- test/02_validate_requires_allowextra.rb
|
130
131
|
- test/gfx/000_load.rb
|
131
132
|
- test/gfx/001_basic.rb
|
132
133
|
- test/gfx/002_isa.rb
|
@@ -158,13 +159,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
159
|
- !ruby/object:Gem::Version
|
159
160
|
version: '0'
|
160
161
|
requirements: []
|
161
|
-
|
162
|
-
rubygems_version: 2.4.5.4
|
162
|
+
rubygems_version: 3.3.0.dev
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: p5-Data-Validator / p5-Data-Validator-Recursive port
|
166
166
|
test_files:
|
167
167
|
- test/01_orclass.rb
|
168
|
+
- test/02_validate_requires_allowextra.rb
|
168
169
|
- test/gfx/000_load.rb
|
169
170
|
- test/gfx/001_basic.rb
|
170
171
|
- test/gfx/002_isa.rb
|