Skip to content

Commit ef1a078

Browse files
committed
Squashed 'json/' changes from d17e1ba2..2576db4d
2576db4d [350] Fix unmatched pattern-properties 0a0f0cd1 Move the "definitions" area below the main schema part bb80ebe5 Clean up some spacing 9ee9eff1 Add some description annotations 41732dbd Refactor a single test into the "definitions" area 2fc576e7 [53] Add test IDs c3731205 [264] Add pattern and patternProperties tests for non-BMP code points da35d880 [245] Add test for negative prefix in relative-json-pointer git-subtree-dir: json git-subtree-split: 2576db4df31ad6326baff6f2e1e27ea7614512dc
1 parent e0a2a71 commit ef1a078

File tree

13 files changed

+454
-40
lines changed

13 files changed

+454
-40
lines changed

test-schema.json

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,73 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"description": "Schema for tests",
4+
"type": "array",
5+
"items": {
6+
"type": "object",
7+
"required": [ "description", "schema", "tests" ],
8+
"properties": {
9+
"id": {
10+
"description": "Uniquely identifies a set of tests",
11+
"type": "string",
12+
"format": "uri"
13+
},
14+
"description": { "type": "string" },
15+
"schema": {},
16+
"tests": {
17+
"description": "A set of related tests all using the same schema",
18+
"type": "array",
19+
"items": { "$ref": "#/definitions/test" },
20+
"minItems": 1
21+
}
22+
},
23+
"additionalProperties": false,
24+
"minItems": 1
25+
},
326
"definitions": {
427
"outputItem": {
528
"type": "object",
629
"properties": {
7-
"valid": {"type": "boolean"},
8-
"keywordLocation": {"type": "string"},
30+
"valid": { "type": "boolean" },
31+
"keywordLocation": { "type": "string" },
932
"absoluteKeywordLocation": {
1033
"type": "string",
1134
"format": "uri"
1235
},
13-
"instanceLocation": {"type": "string"},
36+
"instanceLocation": { "type": "string" },
1437
"annotations": {
1538
"type": "array",
16-
"items": {"$ref": "#/definitions/outputItem"}
39+
"items": { "$ref": "#/definitions/outputItem" }
1740
},
1841
"errors": {
1942
"type": "array",
20-
"items": {"$ref": "#/definitions/outputItem"}
43+
"items": { "$ref": "#/definitions/outputItem" }
2144
}
2245
}
23-
}
24-
},
25-
"type": "array",
26-
"items": {
27-
"type": "object",
28-
"required": ["description", "schema", "tests"],
29-
"properties": {
30-
"description": {"type": "string"},
31-
"schema": {},
32-
"tests": {
33-
"type": "array",
34-
"items": {
46+
},
47+
"test": {
48+
"description": "A single test",
49+
"type": "object",
50+
"required": [ "description", "data", "valid" ],
51+
"properties": {
52+
"id": {
53+
"description": "Uniquely identifies a single test",
54+
"type": "string",
55+
"format": "uri"
56+
},
57+
"description": { "type": "string" },
58+
"data": {},
59+
"valid": { "type": "boolean" },
60+
"output": {
3561
"type": "object",
36-
"required": ["description", "data", "valid"],
62+
"required": [ "basic", "detailed", "verbose" ],
3763
"properties": {
38-
"description": {"type": "string"},
39-
"data": {},
40-
"valid": {"type": "boolean"},
41-
"output": {
42-
"type": "object",
43-
"properties": {
44-
"basic": {"$ref": "#/definitions/outputItem"},
45-
"detailed": {"$ref": "#/definitions/outputItem"},
46-
"verbose": {"$ref": "#/definitions/outputItem"}
47-
},
48-
"required": ["basic", "detailed", "verbose"]
49-
}
50-
},
51-
"additionalProperties": false
52-
},
53-
"minItems": 1
54-
}
55-
},
56-
"additionalProperties": false,
57-
"minItems": 1
64+
"basic": { "$ref": "#/definitions/outputItem" },
65+
"detailed": { "$ref": "#/definitions/outputItem" },
66+
"verbose": { "$ref": "#/definitions/outputItem" }
67+
}
68+
}
69+
},
70+
"additionalProperties": false
71+
}
5872
}
5973
}

tests/draft2019-09/optional/format/relative-json-pointer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"valid": true
1010
},
1111
{
12-
"description": "a valid downwards RJP",
12+
"description": "a valid downwards RJP",
1313
"data": "0/foo/bar",
1414
"valid": true
1515
},
@@ -27,6 +27,11 @@
2727
"description": "an invalid RJP that is a valid JSON Pointer",
2828
"data": "/foo/bar",
2929
"valid": false
30+
},
31+
{
32+
"description": "negative prefix",
33+
"data": "-1/foo/bar",
34+
"valid": false
3035
}
3136
]
3237
}

tests/draft2019-09/pattern.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,46 @@
5555
"valid": true
5656
}
5757
]
58+
},
59+
{
60+
"description": "non-BMP, checks for proper surrogate pair handling for UTF-16",
61+
"schema": { "pattern": "^🐲*$" },
62+
"tests": [
63+
{
64+
"description": "matches empty",
65+
"data": "",
66+
"valid": true
67+
},
68+
{
69+
"description": "matches single",
70+
"data": "🐲",
71+
"valid": true
72+
},
73+
{
74+
"description": "matches two",
75+
"data": "🐲🐲",
76+
"valid": true
77+
},
78+
{
79+
"description": "doesn't match one",
80+
"data": "🐉",
81+
"valid": false
82+
},
83+
{
84+
"description": "doesn't match two",
85+
"data": "🐉🐉",
86+
"valid": false
87+
},
88+
{
89+
"description": "doesn't match one ASCII",
90+
"data": "D",
91+
"valid": false
92+
},
93+
{
94+
"description": "doesn't match two ASCII",
95+
"data": "DD",
96+
"valid": false
97+
}
98+
]
5899
}
59100
]

tests/draft2019-09/patternProperties.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,42 @@
147147
"valid": true
148148
}
149149
]
150+
},
151+
{
152+
"description": "non-BMP, checks for proper surrogate pair handling for UTF-16",
153+
"schema": {
154+
"patternProperties": {
155+
"^🐲*$": {
156+
"type": "integer"
157+
}
158+
}
159+
},
160+
"tests": [
161+
{
162+
"description": "matches empty",
163+
"data": { "": 1 },
164+
"valid": true
165+
},
166+
{
167+
"description": "matches single",
168+
"data": { "🐲": 1 },
169+
"valid": true
170+
},
171+
{
172+
"description": "matches two",
173+
"data": { "🐲🐲": 1 },
174+
"valid": true
175+
},
176+
{
177+
"description": "doesn't match one",
178+
"data": { "🐲": "hello" },
179+
"valid": false
180+
},
181+
{
182+
"description": "doesn't match two",
183+
"data": { "🐲🐲": "hello" },
184+
"valid": false
185+
}
186+
]
150187
}
151188
]

tests/draft3/pattern.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,46 @@
5555
"valid": true
5656
}
5757
]
58+
},
59+
{
60+
"description": "non-BMP, checks for proper surrogate pair handling for UTF-16",
61+
"schema": { "pattern": "^🐲*$" },
62+
"tests": [
63+
{
64+
"description": "matches empty",
65+
"data": "",
66+
"valid": true
67+
},
68+
{
69+
"description": "matches single",
70+
"data": "🐲",
71+
"valid": true
72+
},
73+
{
74+
"description": "matches two",
75+
"data": "🐲🐲",
76+
"valid": true
77+
},
78+
{
79+
"description": "doesn't match one",
80+
"data": "🐉",
81+
"valid": false
82+
},
83+
{
84+
"description": "doesn't match two",
85+
"data": "🐉🐉",
86+
"valid": false
87+
},
88+
{
89+
"description": "doesn't match one ASCII",
90+
"data": "D",
91+
"valid": false
92+
},
93+
{
94+
"description": "doesn't match two ASCII",
95+
"data": "DD",
96+
"valid": false
97+
}
98+
]
5899
}
59100
]

tests/draft3/patternProperties.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,42 @@
111111
"valid": false
112112
}
113113
]
114+
},
115+
{
116+
"description": "non-BMP, checks for proper surrogate pair handling for UTF-16",
117+
"schema": {
118+
"patternProperties": {
119+
"^🐲*$": {
120+
"type": "integer"
121+
}
122+
}
123+
},
124+
"tests": [
125+
{
126+
"description": "matches empty",
127+
"data": { "": 1 },
128+
"valid": true
129+
},
130+
{
131+
"description": "matches single",
132+
"data": { "🐲": 1 },
133+
"valid": true
134+
},
135+
{
136+
"description": "matches two",
137+
"data": { "🐲🐲": 1 },
138+
"valid": true
139+
},
140+
{
141+
"description": "doesn't match one",
142+
"data": { "🐲": "hello" },
143+
"valid": false
144+
},
145+
{
146+
"description": "doesn't match two",
147+
"data": { "🐲🐲": "hello" },
148+
"valid": false
149+
}
150+
]
114151
}
115152
]

tests/draft4/pattern.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,46 @@
5555
"valid": true
5656
}
5757
]
58+
},
59+
{
60+
"description": "non-BMP, checks for proper surrogate pair handling for UTF-16",
61+
"schema": { "pattern": "^🐲*$" },
62+
"tests": [
63+
{
64+
"description": "matches empty",
65+
"data": "",
66+
"valid": true
67+
},
68+
{
69+
"description": "matches single",
70+
"data": "🐲",
71+
"valid": true
72+
},
73+
{
74+
"description": "matches two",
75+
"data": "🐲🐲",
76+
"valid": true
77+
},
78+
{
79+
"description": "doesn't match one",
80+
"data": "🐉",
81+
"valid": false
82+
},
83+
{
84+
"description": "doesn't match two",
85+
"data": "🐉🐉",
86+
"valid": false
87+
},
88+
{
89+
"description": "doesn't match one ASCII",
90+
"data": "D",
91+
"valid": false
92+
},
93+
{
94+
"description": "doesn't match two ASCII",
95+
"data": "DD",
96+
"valid": false
97+
}
98+
]
5899
}
59100
]

0 commit comments

Comments
 (0)