Skip to content

Commit 47958f8

Browse files
authored
Merge pull request #654 from santhosh-tekuri/output-escape
output: ensure ~ and / are escaped in json-pointer
2 parents 5262997 + c9d9438 commit 47958f8

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[
2+
{
3+
"description": "tilde and forward slash in json-pointer",
4+
"schema": {
5+
"$schema": "https://json-schema.org/draft/2019-09/schema",
6+
"$id": "https://json-schema.org/tests/content/draft2019-09/escape/0",
7+
"properties": {
8+
"~a/b": {"type": "number"}
9+
}
10+
},
11+
"tests": [
12+
{
13+
"description": "incorrect type must be reported, but a message is not required",
14+
"data": {"~a/b": "foobar"},
15+
"output": {
16+
"basic": {
17+
"$id": "https://json-schema.org/tests/content/draft2019-09/escape/0/tests/0/basic",
18+
"$ref": "/draft/2019-09/output/schema",
19+
"properties": {
20+
"errors": {
21+
"contains": {
22+
"properties": {
23+
"keywordLocation": {"const": "/properties/~0a~1b/type"},
24+
"absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2019-09/escape/0#/properties/~0a~1b/type"},
25+
"instanceLocation": {"const": "/~0a~1b"},
26+
"annotation": false
27+
},
28+
"required": ["keywordLocation", "instanceLocation"]
29+
}
30+
}
31+
},
32+
"required": ["errors"]
33+
}
34+
}
35+
}
36+
]
37+
}
38+
]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[
2+
{
3+
"description": "tilde and forward slash in json-pointer",
4+
"schema": {
5+
"$schema": "https://json-schema.org/draft/2020-12/schema",
6+
"$id": "https://json-schema.org/tests/content/draft2020-12/escape/0",
7+
"properties": {
8+
"~a/b": {"type": "number"}
9+
}
10+
},
11+
"tests": [
12+
{
13+
"description": "incorrect type must be reported, but a message is not required",
14+
"data": {"~a/b": "foobar"},
15+
"output": {
16+
"basic": {
17+
"$id": "https://json-schema.org/tests/content/draft2020-12/escape/0/tests/0/basic",
18+
"$ref": "/draft/2020-12/output/schema",
19+
"properties": {
20+
"errors": {
21+
"contains": {
22+
"properties": {
23+
"keywordLocation": {"const": "/properties/~0a~1b/type"},
24+
"absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2020-12/escape/0#/properties/~0a~1b/type"},
25+
"instanceLocation": {"const": "/~0a~1b"},
26+
"annotation": false
27+
},
28+
"required": ["keywordLocation", "instanceLocation"]
29+
}
30+
}
31+
},
32+
"required": ["errors"]
33+
}
34+
}
35+
}
36+
]
37+
}
38+
]

0 commit comments

Comments
 (0)