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 +4 -4
- data/lib/json_schema/schema_error.rb +6 -3
- data/lib/json_schema/validator.rb +4 -2
- 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: 0a228323c155619099b250dca5490ad4a133c8c5
|
4
|
+
data.tar.gz: f4f387127f174dd6e7bf70dc083683e21e267f8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
23
|
+
def initialize(schema, path, message, type, options = {})
|
24
24
|
super(schema, message, type)
|
25
25
|
@path = path
|
26
|
-
|
27
|
-
|
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,
|
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,
|
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.
|
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:
|
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
|