Skip to content

Commit 3fcee38

Browse files
Merge pull request #512 from json-schema-org/ether/formats-and-non-strings
test that format-assertions are valid with non-string types
2 parents 02d7cb5 + b349b87 commit 3fcee38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2529
-95
lines changed

tests/draft-future/optional/format/date-time.json

+36-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of date-time strings",
4-
"schema": {"format": "date-time"},
4+
"schema": { "format": "date-time" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid date-time string",
838
"data": "1963-06-19T08:30:06.283185Z",
@@ -33,6 +63,11 @@
3363
"data": "1990-12-31T15:59:60-24:00",
3464
"valid": false
3565
},
66+
{
67+
"description": "an invalid closing Z after time-zone offset",
68+
"data": "1963-06-19T08:30:06.28123+01:00Z",
69+
"valid": false
70+
},
3671
{
3772
"description": "an invalid date-time string",
3873
"data": "06/19/1963 08:30:06 PST",

tests/draft-future/optional/format/date.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of date strings",
4-
"schema": {"format": "date"},
4+
"schema": { "format": "date" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid date string",
838
"data": "1963-06-19",

tests/draft-future/optional/format/duration.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of duration strings",
4-
"schema": {"format": "duration"},
4+
"schema": { "format": "duration" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid duration string",
838
"data": "P4DT12H30M5S",

tests/draft-future/optional/format/email.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of e-mail addresses",
4-
"schema": {"format": "email"},
4+
"schema": { "format": "email" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid e-mail address",
838
"data": "[email protected]",

tests/draft-future/optional/format/hostname.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of host names",
4-
"schema": {"format": "hostname"},
4+
"schema": { "format": "hostname" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid host name",
838
"data": "www.example.com",

tests/draft-future/optional/format/idn-email.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of an internationalized e-mail addresses",
4-
"schema": {"format": "idn-email"},
4+
"schema": { "format": "idn-email" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid idn e-mail ([email protected] in Hangul)",
838
"data": "실례@실례.테스트",

tests/draft-future/optional/format/idn-hostname.json

+30
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,36 @@
33
"description": "validation of internationalized host names",
44
"schema": { "format": "idn-hostname" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid host name (example.test in Hangul)",
838
"data": "실례.테스트",

tests/draft-future/optional/format/ipv4.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of IP addresses",
4-
"schema": {"format": "ipv4"},
4+
"schema": { "format": "ipv4" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid IP address",
838
"data": "192.168.0.1",

tests/draft-future/optional/format/ipv6.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
11
[
22
{
33
"description": "validation of IPv6 addresses",
4-
"schema": {"format": "ipv6"},
4+
"schema": { "format": "ipv6" },
55
"tests": [
6+
{
7+
"description": "all string formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "all string formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "all string formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "all string formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "all string formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "all string formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
636
{
737
"description": "a valid IPv6 address",
838
"data": "::1",

0 commit comments

Comments
 (0)