json_schema 0.13.2 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1f24463b2049d196fe0ed73305146600d50c870
4
- data.tar.gz: c97c5109678c9786a12219b364640dbe22afd25c
3
+ metadata.gz: 2f5c2d7106b765e16464b19faf83b114eda8eef2
4
+ data.tar.gz: 8e726d2b1af63279c75ee00f6da8f6f22828caa4
5
5
  SHA512:
6
- metadata.gz: dba523a357a759cedd359bfc7a11ba72ab2ab4344f038363ae809ec20008bbfe377435929f93d68c56865c1407f17f952f7e30532893cca28f132891ad66d072
7
- data.tar.gz: 60b178db7b14223cb13a37ee7b06879975fd007b6e487261b2ec8e5cbcd6fa97dd0224e326fbfba898e5ae4b8cbbbc0696210df5bba6f2874c2bf5c8ed6ee914
6
+ metadata.gz: 9dec05abbc55082ef52b87d0b6dac38e4347550a619fe87b033f35b5cff5f0b1e59ad5194b4e5637f7722bda0d64f9bb341e350a9ce642fb9a82c38ee4a960d1
7
+ data.tar.gz: 076853fdad85d71c7396704c741f6f60a536f7d2f4c078e981c167671507e58827a9e5dff7567d86b54adaf8803f0b04d61082010cfa5899129523e966bfca26
@@ -185,10 +185,17 @@ module JsonSchema
185
185
  resolve_uri(ref_schema, uri)
186
186
  # relative
187
187
  elsif uri
188
- # build an absolute path using the URI of the current schema
189
- # TODO: fix this. References don't get URIs which might be an error.
190
- schema_uri = ref_schema.uri.chomp("/")
191
- resolve_uri(ref_schema, URI.parse(schema_uri + "/" + uri.path))
188
+ # Build an absolute path using the URI of the current schema.
189
+ #
190
+ # Note that this code path will never currently be hit because the
191
+ # incoming reference schema will never have a URI.
192
+ if ref_schema.uri
193
+ schema_uri = ref_schema.uri.chomp("/")
194
+ resolve_uri(ref_schema, URI.parse(schema_uri + "/" + uri.path))
195
+ else
196
+ nil
197
+ end
198
+
192
199
  # just a JSON Pointer -- resolve against schema root
193
200
  else
194
201
  resolve_pointer(ref_schema, @schema)
@@ -205,6 +205,16 @@ describe JsonSchema::ReferenceExpander do
205
205
  assert_includes error_types, :unresolved_pointer
206
206
  end
207
207
 
208
+ it "errors on a relative URI that cannot be transformed to an absolute" do
209
+ pointer("#/properties").merge!(
210
+ "app" => { "$ref" => "relative#definitions/name" }
211
+ )
212
+ refute expand
213
+ assert_includes error_messages,
214
+ %{Couldn't resolve references: relative#definitions/name.}
215
+ assert_includes error_types, :unresolved_references
216
+ end
217
+
208
218
  it "errors on a reference cycle" do
209
219
  pointer("#/properties").merge!(
210
220
  "app0" => { "$ref" => "#/properties/app2" },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur