Hello community,
here is the log from the commit of package rubygem-json-schema for
openSUSE:Factory checked in at 2018-11-26 10:33:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-json-schema (Old)
and /work/SRC/openSUSE:Factory/.rubygem-json-schema.new.19453 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-json-schema"
Mon Nov 26 10:33:04 2018 rev:7 rq:651610 version:2.8.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-json-schema/rubygem-json-schema.changes
2017-04-11 09:32:04.775974231 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-json-schema.new.19453/rubygem-json-schema.changes
2018-11-26 10:34:29.884733338 +0100
@@ -1,0 +2,6 @@
+Thu Nov 22 05:19:42 UTC 2018 - Stephan Kulow <[email protected]>
+
+- updated to version 2.8.1
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
json-schema-2.8.0.gem
New:
----
json-schema-2.8.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-json-schema.spec ++++++
--- /var/tmp/diff_new_pack.kgQtB6/_old 2018-11-26 10:34:31.496731450 +0100
+++ /var/tmp/diff_new_pack.kgQtB6/_new 2018-11-26 10:34:31.496731450 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-json-schema
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -24,7 +24,7 @@
#
Name: rubygem-json-schema
-Version: 2.8.0
+Version: 2.8.1
Release: 0
%define mod_name json-schema
%define mod_full_name %{mod_name}-%{version}
@@ -33,7 +33,7 @@
BuildRequires: %{rubygem gem2rpm}
BuildRequires: ruby-macros >= 5
Url: http://github.com/ruby-json-schema/json-schema/tree/master
-Source: http://rubygems.org/gems/%{mod_full_name}.gem
+Source: https://rubygems.org/gems/%{mod_full_name}.gem
Source1: gem2rpm.yml
Summary: Ruby JSON Schema Validator
License: MIT
++++++ json-schema-2.8.0.gem -> json-schema-2.8.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2017-02-07 11:35:47.000000000 +0100
+++ new/README.md 2018-10-14 08:18:57.000000000 +0200
@@ -375,6 +375,33 @@
errors = JSON::Validator.fully_validate(schema, {"a" => "23"})
```
+Validating a JSON Schema
+------------------------
+
+To validate that a JSON Schema conforms to the JSON Schema standard,
+you need to validate your schema against the metaschema for the appropriate
+JSON Schema Draft. All of the normal validation methods can be used
+for this. First retrieve the appropriate metaschema from the internal
+cache (using `JSON::Validator.validator_for_name()` or
+`JSON::Validator.validator_for_uri()`) and then simply validate your
+schema against it.
+
+
+```ruby
+require "json-schema"
+
+schema = {
+ "type" => "object",
+ "properties" => {
+ "a" => {"type" => "integer"}
+ }
+}
+
+metaschema = JSON::Validator.validator_for_name("draft4").metaschema
+# => true
+JSON::Validator.validate(metaschema, schema)
+```
+
Controlling Remote Schema Reading
---------------------------------
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/dependencies.rb
new/lib/json-schema/attributes/dependencies.rb
--- old/lib/json-schema/attributes/dependencies.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/dependencies.rb 2018-10-14
08:18:57.000000000 +0200
@@ -34,11 +34,5 @@
value.is_a?(String) || value.is_a?(Array) || value.is_a?(Hash)
end
end
-
- class DependenciesV4Attribute < DependenciesAttribute
- def self.accept_value?(value)
- value.is_a?(Array) || value.is_a?(Hash)
- end
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/dependencies_v4.rb
new/lib/json-schema/attributes/dependencies_v4.rb
--- old/lib/json-schema/attributes/dependencies_v4.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/dependencies_v4.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,11 @@
+require 'json-schema/attributes/dependencies'
+
+module JSON
+ class Schema
+ class DependenciesV4Attribute < DependenciesAttribute
+ def self.accept_value?(value)
+ value.is_a?(Array) || value.is_a?(Hash)
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/divisibleby.rb
new/lib/json-schema/attributes/divisibleby.rb
--- old/lib/json-schema/attributes/divisibleby.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/divisibleby.rb 2018-10-14
08:18:57.000000000 +0200
@@ -12,7 +12,7 @@
factor = current_schema.schema[keyword]
- if factor == 0 || factor == 0.0 || (BigDecimal.new(data.to_s) %
BigDecimal.new(factor.to_s)).to_f != 0
+ if factor == 0 || factor == 0.0 || (BigDecimal(data.to_s) %
BigDecimal(factor.to_s)).to_f != 0
message = "The property '#{build_fragment(fragments)}' was not
divisible by #{factor}"
validation_error(processor, message, fragments, current_schema,
self, options[:record_errors])
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/formats/custom.rb
new/lib/json-schema/attributes/formats/custom.rb
--- old/lib/json-schema/attributes/formats/custom.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/formats/custom.rb 2018-10-14
08:18:57.000000000 +0200
@@ -1,4 +1,4 @@
-require 'json-schema/attribute'
+require 'json-schema/attributes/format'
require 'json-schema/errors/custom_format_error'
module JSON
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/formats/date.rb
new/lib/json-schema/attributes/formats/date.rb
--- old/lib/json-schema/attributes/formats/date.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/formats/date.rb 2018-10-14
08:18:57.000000000 +0200
@@ -1,4 +1,4 @@
-require 'json-schema/attribute'
+require 'json-schema/attributes/format'
module JSON
class Schema
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/formats/date_time.rb
new/lib/json-schema/attributes/formats/date_time.rb
--- old/lib/json-schema/attributes/formats/date_time.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/formats/date_time.rb 2018-10-14
08:18:57.000000000 +0200
@@ -1,4 +1,4 @@
-require 'json-schema/attribute'
+require 'json-schema/attributes/format'
module JSON
class Schema
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/formats/date_time_v4.rb
new/lib/json-schema/attributes/formats/date_time_v4.rb
--- old/lib/json-schema/attributes/formats/date_time_v4.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/formats/date_time_v4.rb 2018-10-14
08:18:57.000000000 +0200
@@ -1,4 +1,4 @@
-require 'json-schema/attribute'
+require 'json-schema/attributes/format'
module JSON
class Schema
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/formats/time.rb
new/lib/json-schema/attributes/formats/time.rb
--- old/lib/json-schema/attributes/formats/time.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/formats/time.rb 2018-10-14
08:18:57.000000000 +0200
@@ -1,4 +1,4 @@
-require 'json-schema/attribute'
+require 'json-schema/attributes/format'
module JSON
class Schema
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/formats/uri.rb
new/lib/json-schema/attributes/formats/uri.rb
--- old/lib/json-schema/attributes/formats/uri.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/formats/uri.rb 2018-10-14
08:18:57.000000000 +0200
@@ -1,4 +1,4 @@
-require 'json-schema/attribute'
+require 'json-schema/attributes/format'
require 'json-schema/errors/uri_error'
module JSON
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limit.rb
new/lib/json-schema/attributes/limit.rb
--- old/lib/json-schema/attributes/limit.rb 2017-02-07 11:35:47.000000000
+0100
+++ new/lib/json-schema/attributes/limit.rb 2018-10-14 08:18:57.000000000
+0200
@@ -48,132 +48,5 @@
raise NotImplementedError
end
end
-
- class MinLengthAttribute < LimitAttribute
- def self.acceptable_type
- String
- end
-
- def self.limit_name
- 'minLength'
- end
-
- def self.error_message(schema)
- "was not of a minimum string length of #{limit(schema)}"
- end
-
- def self.value(data)
- data.length
- end
- end
-
- class MaxLengthAttribute < MinLengthAttribute
- def self.limit_name
- 'maxLength'
- end
-
- def self.error_message(schema)
- "was not of a maximum string length of #{limit(schema)}"
- end
- end
-
- class MinItemsAttribute < LimitAttribute
- def self.acceptable_type
- Array
- end
-
- def self.value(data)
- data.length
- end
-
- def self.limit_name
- 'minItems'
- end
-
- def self.error_message(schema)
- "did not contain a minimum number of items #{limit(schema)}"
- end
- end
-
- class MaxItemsAttribute < MinItemsAttribute
- def self.limit_name
- 'maxItems'
- end
-
- def self.error_message(schema)
- "had more items than the allowed #{limit(schema)}"
- end
- end
-
- class MinPropertiesAttribute < LimitAttribute
- def self.acceptable_type
- Hash
- end
-
- def self.value(data)
- data.size
- end
-
- def self.limit_name
- 'minProperties'
- end
-
- def self.error_message(schema)
- "did not contain a minimum number of properties #{limit(schema)}"
- end
- end
-
- class MaxPropertiesAttribute < MinPropertiesAttribute
- def self.limit_name
- 'maxProperties'
- end
-
- def self.error_message(schema)
- "had more properties than the allowed #{limit(schema)}"
- end
- end
-
- class NumericLimitAttribute < LimitAttribute
- def self.acceptable_type
- Numeric
- end
-
- def self.error_message(schema)
- exclusivity = exclusive?(schema) ? 'exclusively' : 'inclusively'
- format("did not have a %s value of %s, %s", limit_name, limit(schema),
exclusivity)
- end
- end
-
- class MaximumAttribute < NumericLimitAttribute
- def self.limit_name
- 'maximum'
- end
-
- def self.exclusive?(schema)
- schema['exclusiveMaximum']
- end
- end
-
- class MaximumInclusiveAttribute < MaximumAttribute
- def self.exclusive?(schema)
- schema['maximumCanEqual'] == false
- end
- end
-
- class MinimumAttribute < NumericLimitAttribute
- def self.limit_name
- 'minimum'
- end
-
- def self.exclusive?(schema)
- schema['exclusiveMinimum']
- end
- end
-
- class MinimumInclusiveAttribute < MinimumAttribute
- def self.exclusive?(schema)
- schema['minimumCanEqual'] == false
- end
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/items.rb
new/lib/json-schema/attributes/limits/items.rb
--- old/lib/json-schema/attributes/limits/items.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/items.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limit'
+
+module JSON
+ class Schema
+ class ItemsLimitAttribute < LimitAttribute
+ def self.acceptable_type
+ Array
+ end
+
+ def self.value(data)
+ data.length
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/length.rb
new/lib/json-schema/attributes/limits/length.rb
--- old/lib/json-schema/attributes/limits/length.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/length.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limit'
+
+module JSON
+ class Schema
+ class LengthLimitAttribute < LimitAttribute
+ def self.acceptable_type
+ String
+ end
+
+ def self.value(data)
+ data.length
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/max_items.rb
new/lib/json-schema/attributes/limits/max_items.rb
--- old/lib/json-schema/attributes/limits/max_items.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/max_items.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/items'
+
+module JSON
+ class Schema
+ class MaxItemsAttribute < ItemsLimitAttribute
+ def self.limit_name
+ 'maxItems'
+ end
+
+ def self.error_message(schema)
+ "had more items than the allowed #{limit(schema)}"
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/max_length.rb
new/lib/json-schema/attributes/limits/max_length.rb
--- old/lib/json-schema/attributes/limits/max_length.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/max_length.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/length'
+
+module JSON
+ class Schema
+ class MaxLengthAttribute < LengthLimitAttribute
+ def self.limit_name
+ 'maxLength'
+ end
+
+ def self.error_message(schema)
+ "was not of a maximum string length of #{limit(schema)}"
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/max_properties.rb
new/lib/json-schema/attributes/limits/max_properties.rb
--- old/lib/json-schema/attributes/limits/max_properties.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/max_properties.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/properties'
+
+module JSON
+ class Schema
+ class MaxPropertiesAttribute < PropertiesLimitAttribute
+ def self.limit_name
+ 'maxProperties'
+ end
+
+ def self.error_message(schema)
+ "had more properties than the allowed #{limit(schema)}"
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/maximum.rb
new/lib/json-schema/attributes/limits/maximum.rb
--- old/lib/json-schema/attributes/limits/maximum.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/maximum.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/numeric'
+
+module JSON
+ class Schema
+ class MaximumAttribute < NumericLimitAttribute
+ def self.limit_name
+ 'maximum'
+ end
+
+ def self.exclusive?(schema)
+ schema['exclusiveMaximum']
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/json-schema/attributes/limits/maximum_inclusive.rb
new/lib/json-schema/attributes/limits/maximum_inclusive.rb
--- old/lib/json-schema/attributes/limits/maximum_inclusive.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/maximum_inclusive.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,11 @@
+require 'json-schema/attributes/limits/maximum'
+
+module JSON
+ class Schema
+ class MaximumInclusiveAttribute < MaximumAttribute
+ def self.exclusive?(schema)
+ schema['maximumCanEqual'] == false
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/min_items.rb
new/lib/json-schema/attributes/limits/min_items.rb
--- old/lib/json-schema/attributes/limits/min_items.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/min_items.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/items'
+
+module JSON
+ class Schema
+ class MinItemsAttribute < ItemsLimitAttribute
+ def self.limit_name
+ 'minItems'
+ end
+
+ def self.error_message(schema)
+ "did not contain a minimum number of items #{limit(schema)}"
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/min_length.rb
new/lib/json-schema/attributes/limits/min_length.rb
--- old/lib/json-schema/attributes/limits/min_length.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/min_length.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/length'
+
+module JSON
+ class Schema
+ class MinLengthAttribute < LengthLimitAttribute
+ def self.limit_name
+ 'minLength'
+ end
+
+ def self.error_message(schema)
+ "was not of a minimum string length of #{limit(schema)}"
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/min_properties.rb
new/lib/json-schema/attributes/limits/min_properties.rb
--- old/lib/json-schema/attributes/limits/min_properties.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/min_properties.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/properties'
+
+module JSON
+ class Schema
+ class MinPropertiesAttribute < PropertiesLimitAttribute
+ def self.limit_name
+ 'minProperties'
+ end
+
+ def self.error_message(schema)
+ "did not contain a minimum number of properties #{limit(schema)}"
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/minimum.rb
new/lib/json-schema/attributes/limits/minimum.rb
--- old/lib/json-schema/attributes/limits/minimum.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/minimum.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limits/numeric'
+
+module JSON
+ class Schema
+ class MinimumAttribute < NumericLimitAttribute
+ def self.limit_name
+ 'minimum'
+ end
+
+ def self.exclusive?(schema)
+ schema['exclusiveMinimum']
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/json-schema/attributes/limits/minimum_inclusive.rb
new/lib/json-schema/attributes/limits/minimum_inclusive.rb
--- old/lib/json-schema/attributes/limits/minimum_inclusive.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/minimum_inclusive.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,11 @@
+require 'json-schema/attributes/limits/minimum'
+
+module JSON
+ class Schema
+ class MinimumInclusiveAttribute < MinimumAttribute
+ def self.exclusive?(schema)
+ schema['minimumCanEqual'] == false
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/numeric.rb
new/lib/json-schema/attributes/limits/numeric.rb
--- old/lib/json-schema/attributes/limits/numeric.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/numeric.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,16 @@
+require 'json-schema/attributes/limit'
+
+module JSON
+ class Schema
+ class NumericLimitAttribute < LimitAttribute
+ def self.acceptable_type
+ Numeric
+ end
+
+ def self.error_message(schema)
+ exclusivity = exclusive?(schema) ? 'exclusively' : 'inclusively'
+ format("did not have a %s value of %s, %s", limit_name, limit(schema),
exclusivity)
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/limits/properties.rb
new/lib/json-schema/attributes/limits/properties.rb
--- old/lib/json-schema/attributes/limits/properties.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/limits/properties.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,15 @@
+require 'json-schema/attributes/limit'
+
+module JSON
+ class Schema
+ class PropertiesLimitAttribute < LimitAttribute
+ def self.acceptable_type
+ Hash
+ end
+
+ def self.value(data)
+ data.size
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/properties.rb
new/lib/json-schema/attributes/properties.rb
--- old/lib/json-schema/attributes/properties.rb 2017-02-07
11:35:47.000000000 +0100
+++ new/lib/json-schema/attributes/properties.rb 2018-10-14
08:18:57.000000000 +0200
@@ -62,13 +62,5 @@
end
end
end
-
- class PropertiesV4Attribute < PropertiesAttribute
- # draft4 relies on its own RequiredAttribute validation at a higher
level, rather than
- # as an attribute of individual properties.
- def self.required?(schema, options)
- options[:strict] == true
- end
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/attributes/properties_v4.rb
new/lib/json-schema/attributes/properties_v4.rb
--- old/lib/json-schema/attributes/properties_v4.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/json-schema/attributes/properties_v4.rb 2018-10-14
08:18:57.000000000 +0200
@@ -0,0 +1,13 @@
+require 'json-schema/attributes/properties'
+
+module JSON
+ class Schema
+ class PropertiesV4Attribute < PropertiesAttribute
+ # draft4 relies on its own RequiredAttribute validation at a higher
level, rather than
+ # as an attribute of individual properties.
+ def self.required?(schema, options)
+ options[:strict] == true
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/validator.rb
new/lib/json-schema/validator.rb
--- old/lib/json-schema/validator.rb 2017-02-07 11:35:47.000000000 +0100
+++ new/lib/json-schema/validator.rb 2018-10-14 08:18:57.000000000 +0200
@@ -103,6 +103,8 @@
if @options[:list]
base_schema.to_array_schema
+ elsif base_schema.is_a?(Hash)
+ JSON::Schema.new(base_schema, schema_uri, @options[:version])
else
base_schema
end
@@ -578,7 +580,7 @@
begin
json_uri = Util::URI.normalized_uri(data)
data = self.class.parse(custom_open(json_uri))
- rescue JSON::Schema::JsonLoadError
+ rescue JSON::Schema::JsonLoadError, JSON::Schema::UriError
# Silently discard the error - use the data as-is
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema/validators/draft6.rb
new/lib/json-schema/validators/draft6.rb
--- old/lib/json-schema/validators/draft6.rb 2017-02-07 11:35:47.000000000
+0100
+++ new/lib/json-schema/validators/draft6.rb 2018-10-14 08:18:57.000000000
+0200
@@ -43,8 +43,8 @@
'uri' => UriFormat
}
@formats = @default_formats.clone
- @uri = JSON::Util::URI.parse("http://json-schema.org/draft-06/schema#")
- @names = ["draft6", "http://json-schema.org/draft-06/schema#"]
+ @uri = JSON::Util::URI.parse("http://json-schema.org/draft/schema#")
+ @names = ["draft6", "http://json-schema.org/draft/schema#"]
@metaschema_name = "draft-06.json"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/json-schema.rb new/lib/json-schema.rb
--- old/lib/json-schema.rb 2017-02-07 11:35:47.000000000 +0100
+++ new/lib/json-schema.rb 2018-10-14 08:18:57.000000000 +0200
@@ -14,6 +14,5 @@
require 'json-schema/schema/reader'
require 'json-schema/validator'
-Dir[File.join(File.dirname(__FILE__), "json-schema/attributes/*.rb")].each
{|file| require file }
-Dir[File.join(File.dirname(__FILE__),
"json-schema/attributes/formats/*.rb")].each {|file| require file }
+Dir[File.join(File.dirname(__FILE__), "json-schema/attributes/**/*.rb")].each
{|file| require file }
Dir[File.join(File.dirname(__FILE__),
"json-schema/validators/*.rb")].sort!.each {|file| require file }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2017-02-07 11:35:47.000000000 +0100
+++ new/metadata 2018-10-14 08:18:57.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: json-schema
version: !ruby/object:Gem::Version
- version: 2.8.0
+ version: 2.8.1
platform: ruby
authors:
- Kenny Hoxworth
autorequire:
bindir: bin
cert_chain: []
-date: 2017-02-07 00:00:00.000000000 Z
+date: 2018-10-14 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: rake
@@ -97,6 +97,7 @@
- lib/json-schema/attributes/allof.rb
- lib/json-schema/attributes/anyof.rb
- lib/json-schema/attributes/dependencies.rb
+- lib/json-schema/attributes/dependencies_v4.rb
- lib/json-schema/attributes/disallow.rb
- lib/json-schema/attributes/divisibleby.rb
- lib/json-schema/attributes/enum.rb
@@ -111,6 +112,20 @@
- lib/json-schema/attributes/formats/uri.rb
- lib/json-schema/attributes/items.rb
- lib/json-schema/attributes/limit.rb
+- lib/json-schema/attributes/limits/items.rb
+- lib/json-schema/attributes/limits/length.rb
+- lib/json-schema/attributes/limits/max_items.rb
+- lib/json-schema/attributes/limits/max_length.rb
+- lib/json-schema/attributes/limits/max_properties.rb
+- lib/json-schema/attributes/limits/maximum.rb
+- lib/json-schema/attributes/limits/maximum_inclusive.rb
+- lib/json-schema/attributes/limits/min_items.rb
+- lib/json-schema/attributes/limits/min_length.rb
+- lib/json-schema/attributes/limits/min_properties.rb
+- lib/json-schema/attributes/limits/minimum.rb
+- lib/json-schema/attributes/limits/minimum_inclusive.rb
+- lib/json-schema/attributes/limits/numeric.rb
+- lib/json-schema/attributes/limits/properties.rb
- lib/json-schema/attributes/maxdecimal.rb
- lib/json-schema/attributes/multipleof.rb
- lib/json-schema/attributes/not.rb
@@ -119,6 +134,7 @@
- lib/json-schema/attributes/patternproperties.rb
- lib/json-schema/attributes/properties.rb
- lib/json-schema/attributes/properties_optional.rb
+- lib/json-schema/attributes/properties_v4.rb
- lib/json-schema/attributes/ref.rb
- lib/json-schema/attributes/required.rb
- lib/json-schema/attributes/type.rb
@@ -173,7 +189,7 @@
version: '1.8'
requirements: []
rubyforge_project:
-rubygems_version: 2.6.8
+rubygems_version: 2.7.6
signing_key:
specification_version: 4
summary: Ruby JSON Schema Validator
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/resources/draft-06.json new/resources/draft-06.json
--- old/resources/draft-06.json 2017-02-07 11:35:47.000000000 +0100
+++ new/resources/draft-06.json 2018-10-14 08:18:57.000000000 +0200
@@ -1,7 +1,7 @@
{
- "id": "http://json-schema.org/draft-06/schema#",
- "$schema": "http://json-schema.org/draft-06/schema#",
- "description": "Core schema meta-schema",
+ "$schema": "http://json-schema.org/draft/schema#",
+ "$id": "http://json-schema.org/draft/schema#",
+ "title": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
@@ -13,28 +13,43 @@
"minimum": 0
},
"positiveIntegerDefault0": {
- "allOf": [ { "$ref": "#/definitions/positiveInteger" }, {
"default": 0 } ]
+ "allOf": [
+ { "$ref": "#/definitions/positiveInteger" },
+ { "default": 0 }
+ ]
},
"simpleTypes": {
- "enum": [ "array", "boolean", "integer", "null", "number",
"object", "string" ]
+ "enum": [
+ "array",
+ "boolean",
+ "integer",
+ "null",
+ "number",
+ "object",
+ "string"
+ ]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
- "minItems": 1,
- "uniqueItems": true
+ "uniqueItems": true,
+ "defaultItems": []
}
},
- "type": "object",
+ "type": ["object", "boolean"],
"properties": {
- "id": {
+ "$id": {
"type": "string",
- "format": "uri"
+ "format": "uri-reference"
},
"$schema": {
"type": "string",
"format": "uri"
},
+ "$ref": {
+ "type": "string",
+ "format": "uri-reference"
+ },
"title": {
"type": "string"
},
@@ -44,22 +59,19 @@
"default": {},
"multipleOf": {
"type": "number",
- "minimum": 0,
- "exclusiveMinimum": true
+ "exclusiveMinimum": 0
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
- "type": "boolean",
- "default": false
+ "type": "number"
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
- "type": "boolean",
- "default": false
+ "type": "number"
},
"maxLength": { "$ref": "#/definitions/positiveInteger" },
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
@@ -67,13 +79,7 @@
"type": "string",
"format": "regex"
},
- "additionalItems": {
- "anyOf": [
- { "type": "boolean" },
- { "$ref": "#" }
- ],
- "default": {}
- },
+ "additionalItems": { "$ref": "#" },
"items": {
"anyOf": [
{ "$ref": "#" },
@@ -87,16 +93,11 @@
"type": "boolean",
"default": false
},
+ "contains": { "$ref": "#" },
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
- "additionalProperties": {
- "anyOf": [
- { "type": "boolean" },
- { "$ref": "#" }
- ],
- "default": {}
- },
+ "additionalProperties": { "$ref": "#" },
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
@@ -121,6 +122,8 @@
]
}
},
+ "propertyNames": { "$ref": "#" },
+ "const": {},
"enum": {
"type": "array",
"minItems": 1,
@@ -137,14 +140,11 @@
}
]
},
+ "format": { "type": "string" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
- "dependencies": {
- "exclusiveMaximum": [ "maximum" ],
- "exclusiveMinimum": [ "minimum" ]
- },
"default": {}
}