json_schema 0.10.0 → 0.11.0

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: 8dd8c031b8ddc8eab131da6a1d5872b8c3b3ac06
4
- data.tar.gz: ee2287a4e2a950024e987364afcd6ee0488b0321
3
+ metadata.gz: 0a228323c155619099b250dca5490ad4a133c8c5
4
+ data.tar.gz: f4f387127f174dd6e7bf70dc083683e21e267f8d
5
5
  SHA512:
6
- metadata.gz: d9a4e08cc35055843d3ac60d02797042258b513941ff965f653739f7f05dd4361127d83b3c1a507873b04931d2fdb3ce9565eb7c8c379e2dc4739ec48e67cf22
7
- data.tar.gz: 3ddcf6d896d86616deb12746482cfdb4fd30666dbf55f0af7b1947d5dd93a4e3148b45be581db1107117d91ff9eff285529d0b0184d2cb3e6fbf71003b81ef7a
6
+ metadata.gz: 1221fc9ae3074dfbf3696e95264f5991dc31d6eb19fe391e6945f5ea41c86a8c50e07bcda4b48ea89ffa38c35fd8781e57075a81af6bf073742676a9396caca1
7
+ data.tar.gz: 3b53f66e639b027b4fb482b32c6132d9c91003713519250bb6b75d0a52d06002007ee35042abda4157e37ab077e5e23214bcafeb1141347db9c15cdfd23e531e
@@ -20,11 +20,14 @@ module JsonSchema
20
20
  class ValidationError < SchemaError
21
21
  attr_accessor :data, :path, :sub_errors
22
22
 
23
- def initialize(schema, path, message, type, sub_errors = nil, data: nil)
23
+ def initialize(schema, path, message, type, options = {})
24
24
  super(schema, message, type)
25
25
  @path = path
26
- @sub_errors = sub_errors
27
- @data = data
26
+
27
+ # TODO: change to named optional arguments when Ruby 1.9 support is
28
+ # removed
29
+ @data = options[:data]
30
+ @sub_errors = options[:sub_errors]
28
31
  end
29
32
 
30
33
  def pointer
@@ -161,7 +161,8 @@ module JsonSchema
161
161
 
162
162
  unless subschemata_validity.any? { |valid| valid == true }
163
163
  message = %{No subschema in "anyOf" matched.}
164
- errors << ValidationError.new(schema, path, message, :any_of_failed, sub_errors, data: data)
164
+ errors << ValidationError.new(schema, path, message, :any_of_failed,
165
+ sub_errors: sub_errors, data: data)
165
166
  return false
166
167
  end
167
168
 
@@ -409,7 +410,8 @@ module JsonSchema
409
410
  else
410
411
  %{More than one subschema in "oneOf" matched.}
411
412
  end
412
- errors << ValidationError.new(schema, path, message, :one_of_failed, sub_errors, data: data)
413
+ errors << ValidationError.new(schema, path, message, :one_of_failed,
414
+ sub_errors: sub_errors, data: data)
413
415
 
414
416
  false
415
417
  end
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.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2016-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ecma-re-validator