Skip to content

Commit f7ff13f

Browse files
committed
[299] Add tests for invalid use of fragments in "$id"
1 parent 536ec07 commit f7ff13f

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

tests/draft2019-09/id.json

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
[
2+
{
3+
"description": "Invalid use of fragments in location-independent $id",
4+
"schema": {"$ref": "https://json-schema.org/draft/2019-09/schema"},
5+
"tests": [
6+
{
7+
"description": "Identifier name",
8+
"data": {
9+
"$ref": "#foo",
10+
"$defs": {
11+
"A": {
12+
"$id": "#foo",
13+
"type": "integer"
14+
}
15+
}
16+
},
17+
"valid": false
18+
},
19+
{
20+
"description": "Identifier name and no ref",
21+
"data": {
22+
"$defs": {
23+
"A": { "$id": "#foo" }
24+
}
25+
},
26+
"valid": false
27+
},
28+
{
29+
"description": "Identifier path",
30+
"data": {
31+
"$ref": "#/a/b",
32+
"$defs": {
33+
"A": {
34+
"$id": "#/a/b",
35+
"type": "integer"
36+
}
37+
}
38+
},
39+
"valid": false
40+
},
41+
{
42+
"description": "Identifier name with absolute URI",
43+
"data": {
44+
"$ref": "http://localhost:1234/bar#foo",
45+
"$defs": {
46+
"A": {
47+
"$id": "http://localhost:1234/bar#foo",
48+
"type": "integer"
49+
}
50+
}
51+
},
52+
"valid": false
53+
},
54+
{
55+
"description": "Identifier path with absolute URI",
56+
"data": {
57+
"$ref": "http://localhost:1234/bar#/a/b",
58+
"$defs": {
59+
"A": {
60+
"$id": "http://localhost:1234/bar#/a/b",
61+
"type": "integer"
62+
}
63+
}
64+
},
65+
"valid": false
66+
},
67+
{
68+
"description": "Identifier name with base URI change in subschema",
69+
"data": {
70+
"$id": "http://localhost:1234/root",
71+
"$ref": "http://localhost:1234/nested.json#foo",
72+
"$defs": {
73+
"A": {
74+
"$id": "nested.json",
75+
"$defs": {
76+
"B": {
77+
"$id": "#foo",
78+
"type": "integer"
79+
}
80+
}
81+
}
82+
}
83+
},
84+
"valid": false
85+
},
86+
{
87+
"description": "Identifier path with base URI change in subschema",
88+
"data": {
89+
"$id": "http://localhost:1234/root",
90+
"$ref": "http://localhost:1234/nested.json#/a/b",
91+
"$defs": {
92+
"A": {
93+
"$id": "nested.json",
94+
"$defs": {
95+
"B": {
96+
"$id": "#/a/b",
97+
"type": "integer"
98+
}
99+
}
100+
}
101+
}
102+
},
103+
"valid": false
104+
}
105+
]
106+
}
107+
]

0 commit comments

Comments
 (0)