Skip to content

Commit 89f05e2

Browse files
committed
test fragment resolution with a deep array
1 parent 2a29296 commit 89f05e2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/fragment_resolution_test.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,31 @@ def test_fragment_resolution
2727
JSON::Validator.validate!(schema,data,:fragment => "#/properties/b")
2828
end
2929
end
30+
def test_fragment_resolution_with_array
31+
document = {
32+
"definitions" => {
33+
"schemas" => [
34+
{
35+
"type" => "object",
36+
"required" => ["a"],
37+
"properties" => {
38+
"a" => {
39+
"type" => "object",
40+
}
41+
}
42+
},
43+
{
44+
"type" => "object",
45+
"properties" => {
46+
"b" => {"type" => "integer" }
47+
}
48+
}
49+
]
50+
}
51+
}
52+
53+
data = {"b" => 5}
54+
refute_valid document, data, :fragment => "#/definitions/schemas/0"
55+
assert_valid document, data, :fragment => "#/definitions/schemas/1"
56+
end
3057
end

0 commit comments

Comments
 (0)