From d90b096cbb0b8323448fa40b789c14842bdfe1c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 15 Oct 2019 08:21:42 -1000 Subject: [PATCH] Update json-schema dependency Version 2.8.0 of the json-schema gem assumed the WIP draft 6 URI would be "http://json-schema.org/draft-06/schema#". It happens that it is in fact "http://json-schema.org/draft/schema#". This was fixed in: ruby-json-schema/json-schema#376 json-schema PATCH vesion was bumped, so that version 2.8.1 include this fix. Instead of depending on a buggy version of this gem and using the same wrong URI, switch to the fixed version of the gem and use the expected URI. --- lib/pdk/config/analytics_schema.json | 2 +- lib/pdk/config/json_schema_namespace.rb | 2 +- pdk.gemspec | 2 +- spec/support/file_based_namespaces.rb | 2 +- spec/unit/pdk/config/json_schema_namespace_spec.rb | 6 +++--- spec/unit/pdk/config/json_schema_setting_spec.rb | 4 ++-- spec/unit/pdk/config/json_with_schema_spec.rb | 2 +- spec/unit/pdk/config/schema_files_spec.rb | 2 +- spec/unit/pdk/config/yaml_with_schema_spec.rb | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/pdk/config/analytics_schema.json b/lib/pdk/config/analytics_schema.json index 4b3febffa..19b4c3c8d 100644 --- a/lib/pdk/config/analytics_schema.json +++ b/lib/pdk/config/analytics_schema.json @@ -1,6 +1,6 @@ { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "The PDK Analytics YAML Schema", diff --git a/lib/pdk/config/json_schema_namespace.rb b/lib/pdk/config/json_schema_namespace.rb index c7473afc4..582209bf0 100644 --- a/lib/pdk/config/json_schema_namespace.rb +++ b/lib/pdk/config/json_schema_namespace.rb @@ -106,7 +106,7 @@ def create_missing_setting(key, _initial_value = nil) # # @return [JSON::Schema] def create_empty_schema - ::JSON::Schema.new({}, 'http://json-schema.org/draft-06/schema#') + ::JSON::Schema.new({}, 'http://json-schema.org/draft/schema#') end # Lazily retrieve the JSON schema from disk for this namespace diff --git a/pdk.gemspec b/pdk.gemspec index 0ac52cce6..55bdf7901 100644 --- a/pdk.gemspec +++ b/pdk.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'ffi', '~> 1.9.0' spec.add_runtime_dependency 'gettext-setup', '~> 0.24' spec.add_runtime_dependency 'hitimes', '1.3.0' - spec.add_runtime_dependency 'json-schema', '2.8.0' + spec.add_runtime_dependency 'json-schema', '~> 2.8.1' spec.add_runtime_dependency 'json_pure', '~> 2.1.0' spec.add_runtime_dependency 'minitar', '~> 0.6' spec.add_runtime_dependency 'pathspec', '~> 0.2.1' diff --git a/spec/support/file_based_namespaces.rb b/spec/support/file_based_namespaces.rb index f74d75309..cf7f9199b 100644 --- a/spec/support/file_based_namespaces.rb +++ b/spec/support/file_based_namespaces.rb @@ -86,7 +86,7 @@ <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A Schema", diff --git a/spec/unit/pdk/config/json_schema_namespace_spec.rb b/spec/unit/pdk/config/json_schema_namespace_spec.rb index 41ba295cf..8a2eed0e5 100644 --- a/spec/unit/pdk/config/json_schema_namespace_spec.rb +++ b/spec/unit/pdk/config/json_schema_namespace_spec.rb @@ -23,7 +23,7 @@ def load_and_ignore(namespace) <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A Schema", @@ -74,7 +74,7 @@ def load_and_ignore(namespace) <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A Schema", @@ -104,7 +104,7 @@ def load_and_ignore(namespace) <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A propertyless Schema" diff --git a/spec/unit/pdk/config/json_schema_setting_spec.rb b/spec/unit/pdk/config/json_schema_setting_spec.rb index 0cec8fbb0..b26847087 100644 --- a/spec/unit/pdk/config/json_schema_setting_spec.rb +++ b/spec/unit/pdk/config/json_schema_setting_spec.rb @@ -28,7 +28,7 @@ <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A Schema", @@ -66,7 +66,7 @@ <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A Schema", diff --git a/spec/unit/pdk/config/json_with_schema_spec.rb b/spec/unit/pdk/config/json_with_schema_spec.rb index 5dcf5fe93..2e11c4538 100644 --- a/spec/unit/pdk/config/json_with_schema_spec.rb +++ b/spec/unit/pdk/config/json_with_schema_spec.rb @@ -23,7 +23,7 @@ <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A Schema", diff --git a/spec/unit/pdk/config/schema_files_spec.rb b/spec/unit/pdk/config/schema_files_spec.rb index 291ad805f..e3e127148 100644 --- a/spec/unit/pdk/config/schema_files_spec.rb +++ b/spec/unit/pdk/config/schema_files_spec.rb @@ -9,7 +9,7 @@ it 'is a valid JSON schema document' do # The Schema Document specifies which schema version it uses - expect(schema['$schema']).to match(%r{draft-[\d]+}) + expect(schema['$schema']).to match(%r{draft/schema#\z}) metaschema = JSON::Validator.validator_for_name(schema['$schema']).metaschema expect(JSON::Validator.validate(metaschema, schema)).to be true diff --git a/spec/unit/pdk/config/yaml_with_schema_spec.rb b/spec/unit/pdk/config/yaml_with_schema_spec.rb index 6e754516d..9c36c6156 100644 --- a/spec/unit/pdk/config/yaml_with_schema_spec.rb +++ b/spec/unit/pdk/config/yaml_with_schema_spec.rb @@ -23,7 +23,7 @@ <<-SCHEMA { "definitions": {}, - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft/schema#", "$id": "http://puppet.com/schema/does_not_exist.json", "type": "object", "title": "A Schema",