Skip to content

Commit 113a08e

Browse files
committed
Optional tests for no $schema (2019-09+)
minLength is identical across all drafts, and highly unlikely to ever change, so regardless of how an implementation chooses to process this schema, if it processes it at all the behavior should be consistent. Also, TIL that "type" has *not* always been the same - in the first few drafts it was always an array of types *or schemas*! While we don't even have test suites for those drafts, it seemed better to use a keyword that has never changed.
1 parent 9098359 commit 113a08e

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[
2+
{
3+
"description": "validation without $schema",
4+
"comment": "minLength is the same across all drafts",
5+
"schema": {
6+
"minLength": 2
7+
},
8+
"tests": [
9+
{
10+
"description": "a 3-character string is valid",
11+
"data": "foo",
12+
"valid": true
13+
},
14+
{
15+
"description": "a 1-character string is not valid",
16+
"data": "a",
17+
"valid": false
18+
},
19+
{
20+
"description": "a non-string is valid",
21+
"data": 5,
22+
"valid": true
23+
}
24+
]
25+
}
26+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[
2+
{
3+
"description": "validation without $schema",
4+
"comment": "minLength is the same across all drafts",
5+
"schema": {
6+
"minLength": 2
7+
},
8+
"tests": [
9+
{
10+
"description": "a 3-character string is valid",
11+
"data": "foo",
12+
"valid": true
13+
},
14+
{
15+
"description": "a 1-character string is not valid",
16+
"data": "a",
17+
"valid": false
18+
},
19+
{
20+
"description": "a non-string is valid",
21+
"data": 5,
22+
"valid": true
23+
}
24+
]
25+
}
26+
]

0 commit comments

Comments
 (0)