Skip to content

Commit 87ed320

Browse files
authored
fix(meta-schema): disallow $schema fragments (#1763)
Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
1 parent 5b248f1 commit 87ed320

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎specs/meta/meta.schema.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
"$comment": "Fragments not allowed.",
1212
"pattern": "^[^#]*$"
1313
},
14-
"$schema": { "$ref": "#/$defs/iriString" },
14+
"$schema": {
15+
"$ref": "#/$defs/iriString",
16+
"$comment": "Fragments not allowed.",
17+
"pattern": "^[^#]*$"
18+
},
1519
"$ref": { "$ref": "#/$defs/iriReferenceString" },
1620
"$anchor": { "$ref": "#/$defs/anchorString" },
1721
"$dynamicRef": { "$ref": "#/$defs/anchorString" },
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "../test-suite.schema.json",
3+
4+
"description": "Tests for the $schema keyword",
5+
"tests": [
6+
{
7+
"description": "Absolute URI without a fragment",
8+
"schema": {
9+
"$schema": "https://json-schema.org/v1"
10+
},
11+
"valid": true
12+
},
13+
{
14+
"description": "Absolute URI with an empty fragment",
15+
"schema": {
16+
"$schema": "https://json-schema.org/v1#"
17+
},
18+
"valid": false
19+
},
20+
{
21+
"description": "Absolute URI with a fragment",
22+
"schema": {
23+
"$schema": "https://json-schema.org/v1#frag"
24+
},
25+
"valid": false
26+
}
27+
]
28+
}

0 commit comments

Comments
 (0)