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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18987da218c27d388ff9125c52d5de7f134ca0bd
4
- data.tar.gz: ccc08d794c3acca53bd41381ee93289725756948
3
+ metadata.gz: 9cb25401a147f54d711af69f8cb57b43bf59c7f8
4
+ data.tar.gz: cca00f70f0db5120ded3b7185b040a4ffa587683
5
5
  SHA512:
6
- metadata.gz: a6fd39a06bffa1e891ba948eafd12c8c1a6d79fc42307b334c455fe11d26a1ed5dab8d89e27e6b199b6a302bef947ceebc39405070f0f473e90b7ba8f69f28d0
7
- data.tar.gz: 27679f000218340b5ed6d249ae0b1ca0217de4cde8fb57b5b1dd121d49390f1fec57f48697897b64ba1d52911657c5b9a21c71772838bcacde7aaccabe00eaa1
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.include?(data.class)
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.0
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-27 00:00:00.000000000 Z
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