Skip to content

Commit c84912b

Browse files
committed
[300] Add tests for valid use of empty fragments in "$id"
1 parent f7ff13f commit c84912b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/draft2019-09/id.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,46 @@
103103
"valid": false
104104
}
105105
]
106+
},
107+
{
108+
"description": "Valid use of empty fragments in location-independent $id",
109+
"comment": "These are allowed but discouraged",
110+
"schema": {
111+
"$ref": "https://json-schema.org/draft/2019-09/schema"
112+
},
113+
"tests": [
114+
{
115+
"description": "Identifier name with absolute URI",
116+
"data": {
117+
"$ref": "http://localhost:1234/bar",
118+
"$defs": {
119+
"A": {
120+
"$id": "http://localhost:1234/bar#",
121+
"type": "integer"
122+
}
123+
}
124+
},
125+
"valid": true
126+
},
127+
{
128+
"description": "Identifier name with base URI change in subschema",
129+
"data": {
130+
"$id": "http://localhost:1234/root",
131+
"$ref": "http://localhost:1234/nested.json#/$defs/B",
132+
"$defs": {
133+
"A": {
134+
"$id": "nested.json",
135+
"$defs": {
136+
"B": {
137+
"$id": "#",
138+
"type": "integer"
139+
}
140+
}
141+
}
142+
}
143+
},
144+
"valid": true
145+
}
146+
]
106147
}
107148
]

0 commit comments

Comments
 (0)