Skip to content

Commit 8891d81

Browse files
Merge pull request #519 from json-schema-org/ether/custom-dialect
test the format-assertion vocabulary with a custom metaschema
2 parents 3fcee38 + 5f5fccd commit 8891d81

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$id": "http://localhost:1234/draft2020-12/format-assertion-false.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$vocabulary": {
5+
"https://json-schema.org/draft/2020-12/vocab/core": true,
6+
"https://json-schema.org/draft/2020-12/vocab/format-assertion": false
7+
},
8+
"allOf": [
9+
{ "$ref": "https://json-schema.org/draft/2020-12/schema/meta/core" },
10+
{ "$ref": "https://json-schema.org/draft/2020-12/schema/meta/format-assertion" }
11+
]
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$id": "http://localhost:1234/draft2020-12/format-assertion-true.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$vocabulary": {
5+
"https://json-schema.org/draft/2020-12/vocab/core": true,
6+
"https://json-schema.org/draft/2020-12/vocab/format-assertion": true
7+
},
8+
"allOf": [
9+
{ "$ref": "https://json-schema.org/draft/2020-12/schema/meta/core" },
10+
{ "$ref": "https://json-schema.org/draft/2020-12/schema/meta/format-assertion" }
11+
]
12+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"description": "schema that uses custom metaschema with format-assertion: false",
4+
"schema": {
5+
"$id": "https://schema/using/format-assertion/false",
6+
"$schema": "http://localhost:1234/draft2020-12/format-assertion-false.json",
7+
"format": "ipv4"
8+
},
9+
"tests": [
10+
{
11+
"description": "format-assertion: false: valid string",
12+
"data": "127.0.0.1",
13+
"valid": true
14+
},
15+
{
16+
"description": "format-assertion: false: invalid string",
17+
"data": "not-an-ipv4",
18+
"valid": false
19+
}
20+
]
21+
},
22+
{
23+
"description": "schema that uses custom metaschema with format-assertion: true",
24+
"schema": {
25+
"$id": "https://schema/using/format-assertion/true",
26+
"$schema": "http://localhost:1234/draft2020-12/format-assertion-true.json",
27+
"format": "ipv4"
28+
},
29+
"tests": [
30+
{
31+
"description": "format-assertion: true: valid string",
32+
"data": "127.0.0.1",
33+
"valid": true
34+
},
35+
{
36+
"description": "format-assertion: true: invalid string",
37+
"data": "not-an-ipv4",
38+
"valid": false
39+
}
40+
]
41+
}
42+
]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"description": "schema that uses custom metaschema with format-assertion: false",
4+
"schema": {
5+
"$id": "https://schema/using/format-assertion/false",
6+
"$schema": "http://localhost:1234/draft2020-12/format-assertion-false.json",
7+
"format": "ipv4"
8+
},
9+
"tests": [
10+
{
11+
"description": "format-assertion: false: valid string",
12+
"data": "127.0.0.1",
13+
"valid": true
14+
},
15+
{
16+
"description": "format-assertion: false: invalid string",
17+
"data": "not-an-ipv4",
18+
"valid": false
19+
}
20+
]
21+
},
22+
{
23+
"description": "schema that uses custom metaschema with format-assertion: true",
24+
"schema": {
25+
"$id": "https://schema/using/format-assertion/true",
26+
"$schema": "http://localhost:1234/draft2020-12/format-assertion-true.json",
27+
"format": "ipv4"
28+
},
29+
"tests": [
30+
{
31+
"description": "format-assertion: true: valid string",
32+
"data": "127.0.0.1",
33+
"valid": true
34+
},
35+
{
36+
"description": "format-assertion: true: invalid string",
37+
"data": "not-an-ipv4",
38+
"valid": false
39+
}
40+
]
41+
}
42+
]

0 commit comments

Comments
 (0)