Skip to content

Commit 8b797cf

Browse files
Merge pull request #520 from json-schema-org/ether/custom-dialect
test the use of the $vocabulary keyword in a custom metaschema
2 parents 54440ea + 3d00f59 commit 8b797cf

File tree

5 files changed

+124
-0
lines changed

5 files changed

+124
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "http://localhost:1234/draft2019-09/metaschema-no-validation.json",
3+
"$vocabulary": {
4+
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
5+
"https://json-schema.org/draft/2019-09/vocab/core": true
6+
},
7+
"allOf": [
8+
{ "$ref": "https://json-schema.org/draft/2019-09/meta/applicator" },
9+
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }
10+
]
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
3+
"$vocabulary": {
4+
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
5+
"https://json-schema.org/draft/2020-12/vocab/core": true
6+
},
7+
"allOf": [
8+
{ "$ref": "https://json-schema.org/draft/2020-12/meta/applicator" },
9+
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }
10+
]
11+
}

tests/draft-future/vocabulary.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"description": "schema that uses custom metaschema with with no validation vocabulary",
4+
"schema": {
5+
"$id": "https://schema/using/no/validation",
6+
"$schema": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
7+
"properties": {
8+
"badProperty": false,
9+
"numberProperty": {
10+
"minimum": 10
11+
}
12+
}
13+
},
14+
"tests": [
15+
{
16+
"description": "applicator vocabulary still works",
17+
"data": {
18+
"badProperty": "this property should not exist"
19+
},
20+
"valid": false
21+
},
22+
{
23+
"description": "no validation: valid number",
24+
"data": 20,
25+
"valid": true
26+
},
27+
{
28+
"description": "no validation: invalid number, but it still validates",
29+
"data": 1,
30+
"valid": true
31+
}
32+
]
33+
}
34+
]

tests/draft2019-09/vocabulary.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"description": "schema that uses custom metaschema with with no validation vocabulary",
4+
"schema": {
5+
"$id": "https://schema/using/no/validation",
6+
"$schema": "http://localhost:1234/draft2019-09/metaschema-no-validation.json",
7+
"properties": {
8+
"badProperty": false,
9+
"numberProperty": {
10+
"minimum": 10
11+
}
12+
}
13+
},
14+
"tests": [
15+
{
16+
"description": "applicator vocabulary still works",
17+
"data": {
18+
"badProperty": "this property should not exist"
19+
},
20+
"valid": false
21+
},
22+
{
23+
"description": "no validation: valid number",
24+
"data": 20,
25+
"valid": true
26+
},
27+
{
28+
"description": "no validation: invalid number, but it still validates",
29+
"data": 1,
30+
"valid": true
31+
}
32+
]
33+
}
34+
]

tests/draft2020-12/vocabulary.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"description": "schema that uses custom metaschema with with no validation vocabulary",
4+
"schema": {
5+
"$id": "https://schema/using/no/validation",
6+
"$schema": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
7+
"properties": {
8+
"badProperty": false,
9+
"numberProperty": {
10+
"minimum": 10
11+
}
12+
}
13+
},
14+
"tests": [
15+
{
16+
"description": "applicator vocabulary still works",
17+
"data": {
18+
"badProperty": "this property should not exist"
19+
},
20+
"valid": false
21+
},
22+
{
23+
"description": "no validation: valid number",
24+
"data": 20,
25+
"valid": true
26+
},
27+
{
28+
"description": "no validation: invalid number, but it still validates",
29+
"data": 1,
30+
"valid": true
31+
}
32+
]
33+
}
34+
]

0 commit comments

Comments
 (0)