json_schema 0.13.5 → 0.13.6

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: 714bee88016f66e9aa064a65cbdcac3da544345c
4
- data.tar.gz: ac1aee2ff1cfc8fdfc8733782eba71485d473588
3
+ metadata.gz: ad178e92388beab0aa3fb7711c8302cc2b82e28d
4
+ data.tar.gz: 4b49ae2eb3984d02e2fe22d2cf64850cf0ca1a47
5
5
  SHA512:
6
- metadata.gz: c71070be974462466e3717a15d944e9c950a600ab0f3665fac62b5b6261acaa0ab27acbf75bdf53a998a2deb601e5bdb683784ff68627cef1e05afefe9c4c313
7
- data.tar.gz: cc0418ca51ae31501d1480521d2d9f5ef91987f9ef4bf879c06729a23a29eeef20a52dc6b1c5fa81f403d76d5b799632687dd37907d2724b0de8f0daf69303f2
6
+ metadata.gz: 19a0ecfe134501cd724985385611a5bb9b04613f6cc25f81f5163fb228c757555bfb363fe1dacae7e7a420235e46d6034eed0c5177d29ffd40c2f9b0c382db1d
7
+ data.tar.gz: 28db95313452012277f5ce37426e15f04e342c30c7c637f72dc58763a3d6f66e419534c25782ee72ebe22e92a4f17b9af86c4aab401590babf27be695f94de8c
@@ -28,7 +28,11 @@ module JsonSchema
28
28
  end
29
29
 
30
30
  def to_s
31
- "#{schema.pointer}: #{message}"
31
+ if schema && schema.pointer
32
+ "#{schema.pointer}: #{message}"
33
+ else
34
+ message
35
+ end
32
36
  end
33
37
  end
34
38
 
@@ -0,0 +1,18 @@
1
+ require "test_helper"
2
+
3
+ require "json_schema"
4
+
5
+ describe JsonSchema::SchemaError do
6
+ it "can print a message with a pointer" do
7
+ schema = JsonSchema::Schema.new
8
+ schema.fragment = "#"
9
+
10
+ e = JsonSchema::SchemaError.new(schema, "problem", nil)
11
+ assert_equal "#: problem", e.to_s
12
+ end
13
+
14
+ it "can print a message without a pointer" do
15
+ e = JsonSchema::SchemaError.new(nil, "problem", nil)
16
+ assert_equal "problem", e.to_s
17
+ end
18
+ end
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.5
4
+ version: 0.13.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
@@ -125,6 +125,7 @@ files:
125
125
  - test/json_pointer/evaluator_test.rb
126
126
  - test/json_reference/reference_test.rb
127
127
  - test/json_schema/document_store_test.rb
128
+ - test/json_schema/error_test.rb
128
129
  - test/json_schema/parser_test.rb
129
130
  - test/json_schema/reference_expander_test.rb
130
131
  - test/json_schema/validator_test.rb