Skip to content

Commit 8694cfd

Browse files
committed
add test for fragment resolution where the fragment contains characters that must be escaped in json pointer syntax
1 parent 3ab7a56 commit 8694cfd

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
@@ -54,4 +54,31 @@ def test_fragment_resolution_with_array
5454
refute_valid document, data, :fragment => "#/definitions/schemas/0"
5555
assert_valid document, data, :fragment => "#/definitions/schemas/1"
5656
end
57+
def test_fragment_resolution_with_special_chars
58+
document = {
59+
"de~fi/nitions" => {
60+
"schemas" => [
61+
{
62+
"type" => "object",
63+
"required" => ["a"],
64+
"properties" => {
65+
"a" => {
66+
"type" => "object",
67+
}
68+
}
69+
},
70+
{
71+
"type" => "object",
72+
"properties" => {
73+
"b" => {"type" => "integer" }
74+
}
75+
}
76+
]
77+
}
78+
}
79+
80+
data = {"b" => 5}
81+
refute_valid document, data, :fragment => "#/de~0fi~1nitions/schemas/0"
82+
assert_valid document, data, :fragment => "#/de~0fi~1nitions/schemas/1"
83+
end
5784
end

0 commit comments

Comments
 (0)