json_schema 0.12.1 → 0.12.2
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/reference_expander.rb +9 -0
- data/test/json_schema_test.rb +1 -1
- 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: d8220dab130851efc9d0b3be1f63dcf9412554b5
|
4
|
+
data.tar.gz: b9f5514e49505e13e9a72da98e21169a97eb6507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5bdafba2a10e990f30e99355e19230831b37b04d953cbda1663b762eb818f3514b75583f21af3047ab92b5ede170a2a78891ae07711fe0b54213558114c5a69
|
7
|
+
data.tar.gz: ff35c642be21c5f39ddc100dda622ddb22d9122693ee0225a1614b619fdb832852a320fbbfd7f08d29107e0d19e4e72849e6a2ecc303d9312583cda6a37b0887
|
@@ -42,6 +42,15 @@ module JsonSchema
|
|
42
42
|
|
43
43
|
def add_reference(schema)
|
44
44
|
uri = URI.parse(schema.uri)
|
45
|
+
|
46
|
+
# In case we've already added a schema for the same reference, don't
|
47
|
+
# re-add it unless the new schema's pointer path is shorter than the one
|
48
|
+
# we've already stored.
|
49
|
+
stored_schema = lookup_reference(uri)
|
50
|
+
if stored_schema && stored_schema.pointer.length < schema.pointer.length
|
51
|
+
return
|
52
|
+
end
|
53
|
+
|
45
54
|
if uri.absolute?
|
46
55
|
@store.add_schema(schema)
|
47
56
|
else
|
data/test/json_schema_test.rb
CHANGED
@@ -28,7 +28,7 @@ describe JsonSchema do
|
|
28
28
|
pointer("#/properties").merge!(
|
29
29
|
"app" => 4
|
30
30
|
)
|
31
|
-
e = assert_raises(
|
31
|
+
e = assert_raises(JsonSchema::AggregateError) do
|
32
32
|
JsonSchema.parse!(schema_sample)
|
33
33
|
end
|
34
34
|
assert_includes e.message, %{4 is not a valid schema.}
|
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.12.
|
4
|
+
version: 0.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ecma-re-validator
|