Skip to content

Commit a0779be

Browse files
committed
add test for fragment resolution where the fragment contains characters that must be escaped in json pointer syntax
1 parent fb847d0 commit a0779be

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
@@ -108,4 +108,31 @@ def test_array_fragment_resolution
108108
assert_valid schema, 5, :fragment => "#/properties/a/anyOf/0"
109109
refute_valid schema, 5, :fragment => "#/properties/a/anyOf/1"
110110
end
111+
def test_fragment_resolution_with_special_chars
112+
document = {
113+
"de~fi/nitions" => {
114+
"schemas" => [
115+
{
116+
"type" => "object",
117+
"required" => ["a"],
118+
"properties" => {
119+
"a" => {
120+
"type" => "object",
121+
}
122+
}
123+
},
124+
{
125+
"type" => "object",
126+
"properties" => {
127+
"b" => {"type" => "integer" }
128+
}
129+
}
130+
]
131+
}
132+
}
133+
134+
data = {"b" => 5}
135+
refute_valid document, data, :fragment => "#/de~0fi~1nitions/schemas/0"
136+
assert_valid document, data, :fragment => "#/de~0fi~1nitions/schemas/1"
137+
end
111138
end

0 commit comments

Comments
 (0)