json-schema 1.0.0 → 1.0.1
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.
data/README.textile
CHANGED
@@ -22,7 +22,7 @@ module JSON
|
|
22
22
|
end
|
23
23
|
|
24
24
|
if current_schema.schema['additionalProperties'] == false && !extra_properties.empty?
|
25
|
-
message = "The property '#{build_fragment(fragments)}' contains additional properties outside of the schema when none are allowed"
|
25
|
+
message = "The property '#{build_fragment(fragments)}' contains additional properties #{extra_properties.inspect} outside of the schema when none are allowed"
|
26
26
|
validation_error(message, fragments, current_schema, options[:record_errors])
|
27
27
|
elsif current_schema.schema['additionalProperties'].is_a?(Hash)
|
28
28
|
extra_properties.each do |key|
|
@@ -3,7 +3,7 @@ module JSON
|
|
3
3
|
class EnumAttribute < Attribute
|
4
4
|
def self.validate(current_schema, data, fragments, validator, options = {})
|
5
5
|
if !current_schema.schema['enum'].include?(data)
|
6
|
-
message = "The property '#{build_fragment(fragments)}' did not match one of the following values:"
|
6
|
+
message = "The property '#{build_fragment(fragments)}' value #{data.inspect} did not match one of the following values:"
|
7
7
|
current_schema.schema['enum'].each {|val|
|
8
8
|
if val.is_a?(NilClass)
|
9
9
|
message += " null,"
|
@@ -60,7 +60,7 @@ module JSON
|
|
60
60
|
validation_error(message, fragments, current_schema, options[:record_errors])
|
61
61
|
end
|
62
62
|
elsif !valid
|
63
|
-
message = "The property '#{build_fragment(fragments)}' did not match one or more of the following types:"
|
63
|
+
message = "The property '#{build_fragment(fragments)}' of type #{data.class} did not match one or more of the following types:"
|
64
64
|
types.each {|type| message += type.is_a?(String) ? " #{type}," : " (schema)," }
|
65
65
|
message.chop!
|
66
66
|
validation_error(message, fragments, current_schema, options[:record_errors])
|
@@ -8,7 +8,7 @@ require 'date'
|
|
8
8
|
module JSON
|
9
9
|
|
10
10
|
class Schema
|
11
|
-
class ValidationError <
|
11
|
+
class ValidationError < StandardError
|
12
12
|
attr_reader :fragments, :schema
|
13
13
|
|
14
14
|
def initialize(message, fragments, schema)
|
@@ -19,10 +19,10 @@ module JSON
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class SchemaError <
|
22
|
+
class SchemaError < StandardError
|
23
23
|
end
|
24
24
|
|
25
|
-
class JsonParseError <
|
25
|
+
class JsonParseError < StandardError
|
26
26
|
end
|
27
27
|
|
28
28
|
class Attribute
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kenny Hoxworth
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-01-
|
17
|
+
date: 2012-01-25 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|