Debian Codegraph @

share/tests/draft2019-09/optional/format/hostname.json

raw
1 [
2 {
3 "description": "validation of host names",
4 "schema": {
5 "$schema": "https://json-schema.org/draft/2019-09/schema",
6 "format": "hostname"
7 },
8 "tests": [
9 {
10 "description": "all string formats ignore integers",
11 "data": 12,
12 "valid": true
13 },
14 {
15 "description": "all string formats ignore floats",
16 "data": 13.7,
17 "valid": true
18 },
19 {
20 "description": "all string formats ignore objects",
21 "data": {},
22 "valid": true
23 },
24 {
25 "description": "all string formats ignore arrays",
26 "data": [],
27 "valid": true
28 },
29 {
30 "description": "all string formats ignore booleans",
31 "data": false,
32 "valid": true
33 },
34 {
35 "description": "all string formats ignore nulls",
36 "data": null,
37 "valid": true
38 },
39 {
40 "description": "a valid host name",
41 "data": "www.example.com",
42 "valid": true
43 },
44 {
45 "description": "single label",
46 "data": "hostname",
47 "valid": true
48 },
49 {
50 "description": "single label with digits",
51 "data": "h0stn4me",
52 "valid": true
53 },
54 {
55 "description": "single label starting with digit",
56 "data": "1host",
57 "valid": true
58 },
59 {
60 "description": "single label ending with digit",
61 "data": "hostnam3",
62 "valid": true
63 },
64 {
65 "description": "empty string",
66 "data": "",
67 "valid": false
68 },
69 {
70 "description": "single dot",
71 "data": ".",
72 "valid": false
73 },
74 {
75 "description": "leading dot",
76 "data": ".example",
77 "valid": false
78 },
79 {
80 "description": "trailing dot",
81 "data": "example.",
82 "valid": false
83 },
84 {
85 "description": "IDN label separator",
86 "data": "example\uff0ecom",
87 "valid": false
88 },
89 {
90 "description": "single label with hyphen",
91 "data": "host-name",
92 "valid": true
93 },
94 {
95 "description": "starts with hyphen",
96 "data": "-hostname",
97 "valid": false
98 },
99 {
100 "description": "ends with hyphen",
101 "data": "hostname-",
102 "valid": false
103 },
104 {
105 "description": "contains underscore",
106 "data": "host_name",
107 "valid": false
108 },
109 {
110 "description": "exceeds maximum overall length (256)",
111 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
112 "valid": false
113 },
114 {
115 "description": "maximum label length (63)",
116 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
117 "valid": true
118 },
119 {
120 "description": "exceeds maximum label length (63)",
121 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
122 "valid": false
123 },
124 {
125 "description": "trailing newline is invalid",
126 "data": "example.com\n",
127 "valid": false
128 },
129 {
130 "description": "invalid non-ASCII KELVIN SIGN (U+212A)",
131 "data": "\u212Aelvin.example.com",
132 "valid": false
133 },
134 {
135 "description": "consecutive hyphens inside a label",
136 "data": "a--b.com",
137 "valid": true
138 }
139 ]
140 },
141 {
142 "description": "validation of A-label (punycode) host names",
143 "schema": {
144 "$schema": "https://json-schema.org/draft/2019-09/schema",
145 "format": "hostname"
146 },
147 "tests": [
148 {
149 "description": "invalid Punycode",
150 "comment": "https://tools.ietf.org/html/rfc5891#section-4.4 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
151 "data": "xn--X",
152 "valid": false
153 },
154 {
155 "description": "a valid host name (example.test in Hangul)",
156 "data": "xn--9n2bp8q.xn--9t4b11yi5a",
157 "valid": true
158 },
159 {
160 "description": "contains illegal char U+302E Hangul single dot tone mark",
161 "data": "xn--07jt112bpxg.xn--9t4b11yi5a",
162 "valid": false
163 },
164 {
165 "description": "Begins with a Spacing Combining Mark",
166 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
167 "data": "xn--hello-txk",
168 "valid": false
169 },
170 {
171 "description": "Begins with a Nonspacing Mark",
172 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
173 "data": "xn--hello-zed",
174 "valid": false
175 },
176 {
177 "description": "Begins with an Enclosing Mark",
178 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
179 "data": "xn--hello-6bf",
180 "valid": false
181 },
182 {
183 "description": "Exceptions that are PVALID, left-to-right chars",
184 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
185 "data": "xn--zca29lwxobi7a",
186 "valid": true
187 },
188 {
189 "description": "Exceptions that are PVALID, right-to-left chars",
190 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
191 "data": "xn--qmbc",
192 "valid": true
193 },
194 {
195 "description": "Exceptions that are DISALLOWED, right-to-left chars",
196 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
197 "data": "xn--chb89f",
198 "valid": false
199 },
200 {
201 "description": "Exceptions that are DISALLOWED, left-to-right chars",
202 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6 Note: The two combining marks (U+302E and U+302F) are in the middle and not at the start",
203 "data": "xn--07jceefgh4c",
204 "valid": false
205 },
206 {
207 "description": "MIDDLE DOT with no preceding 'l'",
208 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
209 "data": "xn--al-0ea",
210 "valid": false
211 },
212 {
213 "description": "MIDDLE DOT with nothing preceding",
214 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
215 "data": "xn--l-fda",
216 "valid": false
217 },
218 {
219 "description": "MIDDLE DOT with no following 'l'",
220 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
221 "data": "xn--la-0ea",
222 "valid": false
223 },
224 {
225 "description": "MIDDLE DOT with nothing following",
226 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
227 "data": "xn--l-gda",
228 "valid": false
229 },
230 {
231 "description": "MIDDLE DOT with surrounding 'l's",
232 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
233 "data": "xn--ll-0ea",
234 "valid": true
235 },
236 {
237 "description": "Greek KERAIA not followed by Greek",
238 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
239 "data": "xn--S-jib3p",
240 "valid": false
241 },
242 {
243 "description": "Greek KERAIA not followed by anything",
244 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
245 "data": "xn--wva3j",
246 "valid": false
247 },
248 {
249 "description": "Greek KERAIA followed by Greek",
250 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
251 "data": "xn--wva3je",
252 "valid": true
253 },
254 {
255 "description": "Hebrew GERESH not preceded by Hebrew",
256 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
257 "data": "xn--A-2hc5h",
258 "valid": false
259 },
260 {
261 "description": "Hebrew GERESH not preceded by anything",
262 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
263 "data": "xn--5db1e",
264 "valid": false
265 },
266 {
267 "description": "Hebrew GERESH preceded by Hebrew",
268 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
269 "data": "xn--4dbc5h",
270 "valid": true
271 },
272 {
273 "description": "Hebrew GERSHAYIM not preceded by Hebrew",
274 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
275 "data": "xn--A-2hc8h",
276 "valid": false
277 },
278 {
279 "description": "Hebrew GERSHAYIM not preceded by anything",
280 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
281 "data": "xn--5db3e",
282 "valid": false
283 },
284 {
285 "description": "Hebrew GERSHAYIM preceded by Hebrew",
286 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
287 "data": "xn--4dbc8h",
288 "valid": true
289 },
290 {
291 "description": "KATAKANA MIDDLE DOT with no Hiragana, Katakana, or Han",
292 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
293 "data": "xn--defabc-k64e",
294 "valid": false
295 },
296 {
297 "description": "KATAKANA MIDDLE DOT with no other characters",
298 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
299 "data": "xn--vek",
300 "valid": false
301 },
302 {
303 "description": "KATAKANA MIDDLE DOT with Hiragana",
304 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
305 "data": "xn--k8j5u",
306 "valid": true
307 },
308 {
309 "description": "KATAKANA MIDDLE DOT with Katakana",
310 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
311 "data": "xn--bck0j",
312 "valid": true
313 },
314 {
315 "description": "KATAKANA MIDDLE DOT with Han",
316 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
317 "data": "xn--vek778f",
318 "valid": true
319 },
320 {
321 "description": "Arabic-Indic digits mixed with Extended Arabic-Indic digits",
322 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
323 "data": "xn--ngb6iyr",
324 "valid": false
325 },
326 {
327 "description": "Arabic-Indic digits not mixed with Extended Arabic-Indic digits",
328 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
329 "data": "xn--ngba1o",
330 "valid": true
331 },
332 {
333 "description": "Extended Arabic-Indic digits not mixed with Arabic-Indic digits",
334 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.9",
335 "data": "xn--0-gyc",
336 "valid": true
337 },
338 {
339 "description": "ZERO WIDTH JOINER not preceded by Virama",
340 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
341 "data": "xn--11b2er09f",
342 "valid": false
343 },
344 {
345 "description": "ZERO WIDTH JOINER not preceded by anything",
346 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
347 "data": "xn--02b508i",
348 "valid": false
349 },
350 {
351 "description": "ZERO WIDTH JOINER preceded by Virama",
352 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
353 "data": "xn--11b2ezcw70k",
354 "valid": true
355 },
356 {
357 "description": "ZERO WIDTH NON-JOINER preceded by Virama",
358 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1",
359 "data": "xn--11b2ezcs70k",
360 "valid": true
361 },
362 {
363 "description": "ZERO WIDTH NON-JOINER not preceded by Virama but matches regexp",
364 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
365 "data": "xn--ngba5hb2804a",
366 "valid": true
367 },
368 {
369 "description": "contains \"--\" in the 3rd and 4th position",
370 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
371 "data": "XN--aa---o47jg78q",
372 "valid": false
373 }
374 ]
375 }
376 ]