json-schema 2.5.1 → 2.5.2
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 +4 -4
- data/README.textile +2 -2
- data/lib/json-schema/attributes/properties.rb +1 -1
- data/lib/json-schema/validator.rb +14 -6
- metadata +6 -121
- data/test/data/all_of_ref_data.json +0 -3
- data/test/data/any_of_ref_data.json +0 -7
- data/test/data/bad_data_1.json +0 -3
- data/test/data/good_data_1.json +0 -3
- data/test/data/one_of_ref_links_data.json +0 -5
- data/test/schemas/address_microformat.json +0 -18
- data/test/schemas/all_of_ref_base_schema.json +0 -6
- data/test/schemas/all_of_ref_schema.json +0 -7
- data/test/schemas/any_of_ref_jane_schema.json +0 -4
- data/test/schemas/any_of_ref_jimmy_schema.json +0 -4
- data/test/schemas/any_of_ref_john_schema.json +0 -4
- data/test/schemas/any_of_ref_schema.json +0 -15
- data/test/schemas/definition_schema.json +0 -15
- data/test/schemas/extends_and_additionalProperties-1-filename.schema.json +0 -34
- data/test/schemas/extends_and_additionalProperties-1-ref.schema.json +0 -34
- data/test/schemas/extends_and_additionalProperties-2-filename.schema.json +0 -33
- data/test/schemas/extends_and_additionalProperties-2-ref.schema.json +0 -33
- data/test/schemas/good_schema_1.json +0 -10
- data/test/schemas/good_schema_2.json +0 -10
- data/test/schemas/good_schema_extends1.json +0 -10
- data/test/schemas/good_schema_extends2.json +0 -13
- data/test/schemas/inner.schema.json +0 -21
- data/test/schemas/one_of_ref_links_schema.json +0 -16
- data/test/schemas/ref john with spaces schema.json +0 -11
- data/test/schemas/relative_definition_schema.json +0 -8
- data/test/schemas/self_link_schema.json +0 -17
- data/test/schemas/up_link_schema.json +0 -17
- data/test/test_all_of_ref_schema.rb +0 -35
- data/test/test_any_of_ref_schema.rb +0 -35
- data/test/test_bad_schema_ref.rb +0 -39
- data/test/test_common_test_suite.rb +0 -66
- data/test/test_custom_format.rb +0 -116
- data/test/test_definition.rb +0 -15
- data/test/test_extended_schema.rb +0 -62
- data/test/test_extends_and_additionalProperties.rb +0 -52
- data/test/test_files_v3.rb +0 -43
- data/test/test_fragment_resolution.rb +0 -30
- data/test/test_fragment_validation_with_ref.rb +0 -34
- data/test/test_full_validation.rb +0 -208
- data/test/test_helper.rb +0 -47
- data/test/test_initialize_data.rb +0 -118
- data/test/test_jsonschema_draft1.rb +0 -141
- data/test/test_jsonschema_draft2.rb +0 -113
- data/test/test_jsonschema_draft3.rb +0 -450
- data/test/test_jsonschema_draft4.rb +0 -657
- data/test/test_list_option.rb +0 -21
- data/test/test_load_ref_schema.rb +0 -40
- data/test/test_merge_missing_values.rb +0 -45
- data/test/test_minitems.rb +0 -16
- data/test/test_one_of.rb +0 -85
- data/test/test_ruby_schema.rb +0 -59
- data/test/test_schema_loader.rb +0 -74
- data/test/test_schema_type_attribute.rb +0 -20
- data/test/test_schema_validation.rb +0 -185
- data/test/test_stringify.rb +0 -48
- data/test/test_uri_related.rb +0 -67
- data/test/test_validator.rb +0 -53
@@ -1,33 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "http://json-schema.org/draft-03/schema#",
|
3
|
-
"type": "object",
|
4
|
-
"extends": "inner.schema.json",
|
5
|
-
"additionalProperties": {
|
6
|
-
"outerA": {
|
7
|
-
"description": "blah",
|
8
|
-
"required": false,
|
9
|
-
"additionalProperties": false,
|
10
|
-
"properties": {
|
11
|
-
"outerA1": {
|
12
|
-
"type":"boolean",
|
13
|
-
"required": false
|
14
|
-
}
|
15
|
-
}
|
16
|
-
},
|
17
|
-
"outerB": {
|
18
|
-
"required": false,
|
19
|
-
"type": "array",
|
20
|
-
"minItems": 1,
|
21
|
-
"maxItems": 50,
|
22
|
-
"items": {
|
23
|
-
"extends": "inner.schema.json",
|
24
|
-
"additionalProperties": false
|
25
|
-
}
|
26
|
-
},
|
27
|
-
"outerC": {
|
28
|
-
"description": "blah",
|
29
|
-
"type":"boolean",
|
30
|
-
"required": false
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "http://json-schema.org/draft-03/schema#",
|
3
|
-
"type": "object",
|
4
|
-
"extends": {"$ref":"inner.schema.json#"},
|
5
|
-
"additionalProperties": {
|
6
|
-
"outerA": {
|
7
|
-
"description": "blah",
|
8
|
-
"required": false,
|
9
|
-
"additionalProperties": false,
|
10
|
-
"properties": {
|
11
|
-
"outerA1": {
|
12
|
-
"type":"boolean",
|
13
|
-
"required": false
|
14
|
-
}
|
15
|
-
}
|
16
|
-
},
|
17
|
-
"outerB": {
|
18
|
-
"required": false,
|
19
|
-
"type": "array",
|
20
|
-
"minItems": 1,
|
21
|
-
"maxItems": 50,
|
22
|
-
"items": {
|
23
|
-
"extends": {"$ref":"inner.schema.json#"},
|
24
|
-
"additionalProperties": false
|
25
|
-
}
|
26
|
-
},
|
27
|
-
"outerC": {
|
28
|
-
"description": "blah",
|
29
|
-
"type":"boolean",
|
30
|
-
"required": false
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "http://json-schema.org/draft-03/schema#",
|
3
|
-
"type": "object",
|
4
|
-
"properties": {
|
5
|
-
"innerA": {
|
6
|
-
"description": "blah",
|
7
|
-
"type":"boolean",
|
8
|
-
"required": false
|
9
|
-
},
|
10
|
-
"innerB": {
|
11
|
-
"description": "blah",
|
12
|
-
"type":"boolean",
|
13
|
-
"required": false
|
14
|
-
},
|
15
|
-
"innerC": {
|
16
|
-
"description": "blah",
|
17
|
-
"required": false,
|
18
|
-
"type": "boolean"
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
{ "$schema": "http://json-schema.org/draft-04/schema#"
|
2
|
-
, "type": "object"
|
3
|
-
, "properties":
|
4
|
-
{ "links" :
|
5
|
-
{ "type" : "array"
|
6
|
-
, "items" :
|
7
|
-
{ "type" : "object"
|
8
|
-
, "oneOf" :
|
9
|
-
[ { "$ref" : "self_link_schema.json"}
|
10
|
-
, { "$ref" : "up_link_schema.json" }
|
11
|
-
]
|
12
|
-
}
|
13
|
-
}
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{ "$schema": "http://json-schema.org/draft-04/schema#"
|
2
|
-
, "type": "object"
|
3
|
-
, "properties" :
|
4
|
-
{ "rel" :
|
5
|
-
{ "type" : "array"
|
6
|
-
, "items" :
|
7
|
-
[ { "type" : "string"
|
8
|
-
, "pattern" : "self"
|
9
|
-
}
|
10
|
-
]
|
11
|
-
}
|
12
|
-
, "href" :
|
13
|
-
{ "type" : "string"
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{ "$schema": "http://json-schema.org/draft-04/schema#"
|
2
|
-
, "type": "object"
|
3
|
-
, "properties" :
|
4
|
-
{ "rel" :
|
5
|
-
{ "type" : "array"
|
6
|
-
, "items" :
|
7
|
-
[ { "type" : "string"
|
8
|
-
, "pattern" : "up"
|
9
|
-
}
|
10
|
-
]
|
11
|
-
}
|
12
|
-
, "href" :
|
13
|
-
{ "type" : "string"
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', __FILE__)
|
2
|
-
|
3
|
-
class AllOfRefSchemaTest < Minitest::Test
|
4
|
-
def schema
|
5
|
-
schema_fixture_path('all_of_ref_schema.json')
|
6
|
-
end
|
7
|
-
|
8
|
-
def data
|
9
|
-
data_fixture_path('all_of_ref_data.json')
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_all_of_ref_schema_fails
|
13
|
-
refute_valid schema, data
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_all_of_ref_schema_succeeds
|
17
|
-
assert_valid schema, %({"name": 42})
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_all_of_ref_subschema_errors
|
21
|
-
errors = JSON::Validator.fully_validate(schema, data, :errors_as_objects => true)
|
22
|
-
nested_errors = errors[0][:errors]
|
23
|
-
assert_equal([:allof_0], nested_errors.keys, 'should have nested errors for each allOf subschema')
|
24
|
-
assert_match(/the property '#\/name' of type String did not match the following type: integer/i, nested_errors[:allof_0][0][:message])
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_all_of_ref_message
|
28
|
-
errors = JSON::Validator.fully_validate(schema, data)
|
29
|
-
expected_message = """The property '#/' of type Hash did not match all of the required schemas. The schema specific errors were:
|
30
|
-
|
31
|
-
- allOf #0:
|
32
|
-
- The property '#/name' of type String did not match the following type: integer"""
|
33
|
-
assert_equal(expected_message, errors[0])
|
34
|
-
end
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', __FILE__)
|
2
|
-
|
3
|
-
class AnyOfRefSchemaTest < Minitest::Test
|
4
|
-
def schema
|
5
|
-
schema_fixture_path('any_of_ref_schema.json')
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_any_of_ref_schema
|
9
|
-
assert_valid schema, data_fixture_path('any_of_ref_data.json')
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_any_of_ref_subschema_errors
|
13
|
-
data = %({"names": ["jack"]})
|
14
|
-
errors = JSON::Validator.fully_validate(schema, data, :errors_as_objects => true)
|
15
|
-
nested_errors = errors[0][:errors]
|
16
|
-
assert_equal([:anyof_0, :anyof_1, :anyof_2], nested_errors.keys, 'should have nested errors for each anyOf subschema')
|
17
|
-
assert_match(/the property '#\/names\/0' value "jack" did not match the regex 'john'/i, nested_errors[:anyof_0][0][:message])
|
18
|
-
assert_match(/the property '#\/names\/0' value "jack" did not match the regex 'jane'/i, nested_errors[:anyof_1][0][:message])
|
19
|
-
assert_match(/the property '#\/names\/0' value "jack" did not match the regex 'jimmy'/i, nested_errors[:anyof_2][0][:message])
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_any_of_ref_message
|
23
|
-
data = %({"names": ["jack"]})
|
24
|
-
errors = JSON::Validator.fully_validate(schema, data)
|
25
|
-
expected_message = """The property '#/names/0' of type String did not match one or more of the required schemas. The schema specific errors were:
|
26
|
-
|
27
|
-
- anyOf #0:
|
28
|
-
- The property '#/names/0' value \"jack\" did not match the regex 'john'
|
29
|
-
- anyOf #1:
|
30
|
-
- The property '#/names/0' value \"jack\" did not match the regex 'jane'
|
31
|
-
- anyOf #2:
|
32
|
-
- The property '#/names/0' value \"jack\" did not match the regex 'jimmy'"""
|
33
|
-
assert_equal(expected_message, errors[0])
|
34
|
-
end
|
35
|
-
end
|
data/test/test_bad_schema_ref.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', __FILE__)
|
2
|
-
require 'socket'
|
3
|
-
|
4
|
-
|
5
|
-
class BadSchemaRefTest < Minitest::Test
|
6
|
-
def setup
|
7
|
-
WebMock.allow_net_connect!
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
WebMock.disable_net_connect!
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_bad_uri_ref
|
15
|
-
schema = {
|
16
|
-
"$schema" => "http://json-schema.org/draft-04/schema#",
|
17
|
-
"type" => "array",
|
18
|
-
"items" => { "$ref" => "../google.json"}
|
19
|
-
}
|
20
|
-
|
21
|
-
data = [1,2,3]
|
22
|
-
assert_raises(Errno::ENOENT) do
|
23
|
-
JSON::Validator.validate(schema,data)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_bad_host_ref
|
28
|
-
schema = {
|
29
|
-
"$schema" => "http://json-schema.org/draft-04/schema#",
|
30
|
-
"type" => "array",
|
31
|
-
"items" => { "$ref" => "http://ppcheesecheseunicornnuuuurrrrr.example.invalid/json.schema"}
|
32
|
-
}
|
33
|
-
|
34
|
-
data = [1,2,3]
|
35
|
-
assert_raises(SocketError, OpenURI::HTTPError) do
|
36
|
-
JSON::Validator.validate(schema,data)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', __FILE__)
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
class CommonTestSuiteTest < Minitest::Test
|
5
|
-
TEST_DIR = File.expand_path('../test-suite/tests', __FILE__)
|
6
|
-
|
7
|
-
# These are test files which we know fail spectacularly, either because we
|
8
|
-
# don't support that functionality or because they require external
|
9
|
-
# dependencies. To allow finer-grained control over which tests to run,
|
10
|
-
# you can replace `:all` with an array containing the names of individual
|
11
|
-
# tests to skip.
|
12
|
-
IGNORED_TESTS = Hash.new { |h,k| h[k] = [] }.merge({
|
13
|
-
"draft3/optional/jsregex.json" => :all,
|
14
|
-
"draft3/optional/format.json" => [
|
15
|
-
"validation of regular expressions",
|
16
|
-
"validation of e-mail addresses",
|
17
|
-
"validation of URIs",
|
18
|
-
"validation of host names",
|
19
|
-
"validation of CSS colors"
|
20
|
-
],
|
21
|
-
"draft4/optional/format.json" => [
|
22
|
-
"validation of URIs",
|
23
|
-
"validation of e-mail addresses",
|
24
|
-
"validation of host names"
|
25
|
-
]
|
26
|
-
})
|
27
|
-
|
28
|
-
def setup
|
29
|
-
Dir["#{TEST_DIR}/../remotes/**/*.json"].each do |path|
|
30
|
-
schema = path.sub(%r{^.*/remotes/}, '')
|
31
|
-
stub_request(:get, "http://localhost:1234/#{schema}").
|
32
|
-
to_return(:body => File.read(path), :status => 200)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
Dir["#{TEST_DIR}/*"].each do |suite|
|
37
|
-
version = File.basename(suite).to_sym
|
38
|
-
Dir["#{suite}/**/*.json"].each do |tfile|
|
39
|
-
test_list = JSON.parse(File.read(tfile))
|
40
|
-
rel_file = tfile[TEST_DIR.length+1..-1]
|
41
|
-
|
42
|
-
test_list.each do |test|
|
43
|
-
schema = test["schema"]
|
44
|
-
base_description = test["description"]
|
45
|
-
|
46
|
-
test["tests"].each do |t|
|
47
|
-
next if IGNORED_TESTS[rel_file] == :all
|
48
|
-
next if IGNORED_TESTS[rel_file].any? { |ignored|
|
49
|
-
base_description == ignored || "#{base_description}/#{t['description']}" == ignored
|
50
|
-
}
|
51
|
-
|
52
|
-
err_id = "#{rel_file}: #{base_description}/#{t['description']}"
|
53
|
-
define_method("test_#{err_id}") do
|
54
|
-
errors = JSON::Validator.fully_validate(schema,
|
55
|
-
t["data"],
|
56
|
-
:parse_data => false,
|
57
|
-
:validate_schema => true,
|
58
|
-
:version => version
|
59
|
-
)
|
60
|
-
assert_equal t["valid"], errors.empty?, "Common test suite case failed: #{err_id}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
data/test/test_custom_format.rb
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path('../test_helper', __FILE__)
|
3
|
-
|
4
|
-
class JSONSchemaCustomFormatTest < Minitest::Test
|
5
|
-
def setup
|
6
|
-
@all_versions = ['draft1', 'draft2', 'draft3', 'draft4']
|
7
|
-
@format_proc = lambda { |value| raise JSON::Schema::CustomFormatError.new("must be 42") unless value == "42" }
|
8
|
-
@schema_4 = {
|
9
|
-
"$schema" => "http://json-schema.org/draft-04/schema#",
|
10
|
-
"properties" => {
|
11
|
-
"a" => {
|
12
|
-
"type" => "string",
|
13
|
-
"format" => "custom",
|
14
|
-
},
|
15
|
-
}
|
16
|
-
}
|
17
|
-
@schema_3 = @schema_4.clone
|
18
|
-
@schema_3["$schema"] = "http://json-schema.org/draft-03/schema#"
|
19
|
-
@schema_2 = @schema_4.clone
|
20
|
-
@schema_2["$schema"] = "http://json-schema.org/draft-02/schema#"
|
21
|
-
@schema_1 = @schema_4.clone
|
22
|
-
@schema_1["$schema"] = "http://json-schema.org/draft-01/schema#"
|
23
|
-
@schemas = {
|
24
|
-
"draft1" => @schema_1,
|
25
|
-
"draft2" => @schema_2,
|
26
|
-
"draft3" => @schema_3,
|
27
|
-
"draft4" => @schema_4
|
28
|
-
}
|
29
|
-
JSON::Validator.restore_default_formats
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_single_registration
|
33
|
-
@all_versions.each do |version|
|
34
|
-
assert(JSON::Validator.validator_for_name(version).formats['custom'].nil?, "Format 'custom' for #{version} should be nil")
|
35
|
-
JSON::Validator.register_format_validator("custom", @format_proc, [version])
|
36
|
-
assert(JSON::Validator.validator_for_name(version).formats['custom'].is_a?(JSON::Schema::CustomFormat), "Format 'custom' should be registered for #{version}")
|
37
|
-
(@all_versions - [version]).each do |other_version|
|
38
|
-
assert(JSON::Validator.validator_for_name(other_version).formats['custom'].nil?, "Format 'custom' should still be nil for #{other_version}")
|
39
|
-
end
|
40
|
-
JSON::Validator.deregister_format_validator("custom", [version])
|
41
|
-
assert(JSON::Validator.validator_for_name(version).formats['custom'].nil?, "Format 'custom' should be deregistered for #{version}")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_register_for_all_by_default
|
46
|
-
JSON::Validator.register_format_validator("custom", @format_proc)
|
47
|
-
@all_versions.each do |version|
|
48
|
-
assert(JSON::Validator.validator_for_name(version).formats['custom'].is_a?(JSON::Schema::CustomFormat), "Format 'custom' should be registered for #{version}")
|
49
|
-
end
|
50
|
-
JSON::Validator.restore_default_formats
|
51
|
-
@all_versions.each do |version|
|
52
|
-
assert(JSON::Validator.validator_for_name(version).formats['custom'].nil?, "Format 'custom' should still be nil for #{version}")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_multi_registration
|
57
|
-
unregistered_version = @all_versions.delete("draft1")
|
58
|
-
JSON::Validator.register_format_validator("custom", @format_proc, @all_versions)
|
59
|
-
@all_versions.each do |version|
|
60
|
-
assert(JSON::Validator.validator_for_name(version).formats['custom'].is_a?(JSON::Schema::CustomFormat), "Format 'custom' should be registered for #{version}")
|
61
|
-
end
|
62
|
-
assert(JSON::Validator.validator_for_name(unregistered_version).formats['custom'].nil?, "Format 'custom' should still be nil for #{unregistered_version}")
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_format_validation
|
66
|
-
@all_versions.each do |version|
|
67
|
-
data = {
|
68
|
-
"a" => "23"
|
69
|
-
}
|
70
|
-
schema = @schemas[version]
|
71
|
-
prefix = "Validation for '#{version}'"
|
72
|
-
|
73
|
-
assert(JSON::Validator.validate(schema, data), "#{prefix} succeeds with no 'custom' format validator registered")
|
74
|
-
|
75
|
-
JSON::Validator.register_format_validator("custom", @format_proc, [version])
|
76
|
-
data["a"] = "42"
|
77
|
-
assert(JSON::Validator.validate(schema, data), "#{prefix} succeeds with 'custom' format validator and correct data")
|
78
|
-
|
79
|
-
data["a"] = "23"
|
80
|
-
assert(!JSON::Validator.validate(schema, data), "#{prefix} fails with 'custom' format validator and wrong data")
|
81
|
-
|
82
|
-
errors = JSON::Validator.fully_validate(schema, data)
|
83
|
-
assert(errors.count == 1 && errors.first.match(/The property '#\/a' must be 42 in schema/), "#{prefix} records fromat error")
|
84
|
-
|
85
|
-
data["a"] = 23
|
86
|
-
errors = JSON::Validator.fully_validate(schema, data)
|
87
|
-
assert(errors.count == 1 && errors.first.match(/The property '#\/a' of type (?:integer|Fixnum) did not match the following type: string/), "#{prefix} records no fromat error on type mismatch")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_override_default_format
|
92
|
-
@all_versions.each do |version|
|
93
|
-
data = {
|
94
|
-
"a" => "2001:db8:85a3:0:0:8a2e:370:7334"
|
95
|
-
}
|
96
|
-
schema = @schemas[version]
|
97
|
-
schema["properties"]["a"]["format"] = "ipv6"
|
98
|
-
prefix = "Validation for '#{version}'"
|
99
|
-
|
100
|
-
assert(JSON::Validator.validate(schema, data), "#{prefix} succeeds for default format with correct data")
|
101
|
-
|
102
|
-
data["a"] = "no_ip6_address"
|
103
|
-
assert(!JSON::Validator.validate(schema, data), "#{prefix} fails for default format and wrong data")
|
104
|
-
|
105
|
-
data["a"] = "42"
|
106
|
-
JSON::Validator.register_format_validator("ipv6", @format_proc, [version])
|
107
|
-
assert(JSON::Validator.validate(schema, data), "#{prefix} succeeds with overriden default format and correct data")
|
108
|
-
|
109
|
-
JSON::Validator.deregister_format_validator("ipv6", [version])
|
110
|
-
data["a"] = "2001:db8:85a3:0:0:8a2e:370:7334"
|
111
|
-
assert(JSON::Validator.validate(schema, data), "#{prefix} restores the default format on deregistration")
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
|