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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 375dc36afc9706236aa48b7cc3d014e33743c0ff
4
- data.tar.gz: fc069f896647b5f0bde096d12f4e1b65c38ba1bd
3
+ metadata.gz: d8220dab130851efc9d0b3be1f63dcf9412554b5
4
+ data.tar.gz: b9f5514e49505e13e9a72da98e21169a97eb6507
5
5
  SHA512:
6
- metadata.gz: bd3a3e24fb423907e5433345c552b13fc6c36e937086468c7f79ac13d1b2071603bf774f98345e8cc6a11153aedfb892a70b3cb8b28ad21209a66e81fc360731
7
- data.tar.gz: d68d410fdcc8a349cbab6a308b8209a048eabdc72df65f7edbb7558e060cfdcdcdf3c18b9768a84d2670a61a8dc5d92833083d220269fd00ca22bad80a90a215
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
@@ -28,7 +28,7 @@ describe JsonSchema do
28
28
  pointer("#/properties").merge!(
29
29
  "app" => 4
30
30
  )
31
- e = assert_raises(RuntimeError) do
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.1
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-01-19 00:00:00.000000000 Z
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