Sha256: 20bfc578ef929bf74a1c0498f7c210576485509234acd90cdea52a91d06aad87
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require File.expand_path('../support/test_helper', __FILE__) class LoadRefSchemaTest < Minitest::Test def load_other_schema JSON::Validator.add_schema(JSON::Schema.new( { '$schema' => 'http://json-schema.org/draft-04/schema#', 'type' => 'object', 'properties' => { "title" => { "type" => "string" } } }, Addressable::URI.parse("http://example.com/schema#") )) end def test_cached_schema schema_url = "http://example.com/schema#" schema = { "$ref" => schema_url } data = {} load_other_schema _validator = JSON::Validator.new(schema, data) assert JSON::Validator.schema_loaded?(schema_url) end def test_cached_schema_with_fragment schema_url = "http://example.com/schema#" schema = { "$ref" => "#{schema_url}/properties/title" } data = {} load_other_schema _validator = JSON::Validator.new(schema, data) assert JSON::Validator.schema_loaded?(schema_url) end def test_metaschema schema = { "$ref" => "http://json-schema.org/draft-04/schema#" } data = {} assert_valid schema, data end end
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mountapi-0.11.1 | vendor/bundle/ruby/2.7.0/bundler/gems/json-schema-2253a5ee6679/test/load_ref_schema_test.rb |
mountapi-0.11.1 | vendor/json-schema/test/load_ref_schema_test.rb |