json_schema 0.19.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_schema/validator.rb +1 -1
- data/test/json_schema/validator_test.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cb25401a147f54d711af69f8cb57b43bf59c7f8
|
4
|
+
data.tar.gz: cca00f70f0db5120ded3b7185b040a4ffa587683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04d2fc7fcbea934e479002e4cd8489ac31b9a6914fcd01a58e890cfd9f3240cafa81959f5bf81029ce3286136ff6e1439af743a48b701def0002e23f538c1ee6
|
7
|
+
data.tar.gz: d5659272dd75e8de991e90d1b21b447bf9262a100a64b3f46c06f437c0707fd412d74457f9d6be6a7bbfa4aea24742aa3cdbec360a0380b087b56641e03f699a
|
@@ -526,7 +526,7 @@ module JsonSchema
|
|
526
526
|
|
527
527
|
def validate_type(schema, data, errors, path)
|
528
528
|
return true if !schema.type || schema.type.empty?
|
529
|
-
if schema.type_parsed.
|
529
|
+
if schema.type_parsed.any? { |t| data.is_a?(t) }
|
530
530
|
true
|
531
531
|
else
|
532
532
|
key = find_parent(schema)
|
@@ -38,6 +38,16 @@ describe JsonSchema::Validator do
|
|
38
38
|
assert_valid
|
39
39
|
end
|
40
40
|
|
41
|
+
it "validates sub-type successfully" do
|
42
|
+
pointer("#/definitions/app").merge!(
|
43
|
+
"type" => ["object"]
|
44
|
+
)
|
45
|
+
class SomeClass < Hash; end
|
46
|
+
@data_sample = SomeClass.new
|
47
|
+
@data_sample["name"] = "yayrails"
|
48
|
+
assert_valid
|
49
|
+
end
|
50
|
+
|
41
51
|
it "validates type unsuccessfully" do
|
42
52
|
pointer("#/definitions/app").merge!(
|
43
53
|
"type" => ["object"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ecma-re-validator
|