summaryrefslogtreecommitdiff
path: root/json/tests/draft6/optional/format.json
blob: 3dd265fe4f5f48fe0d4bf4d60c2753a5c62392ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
[
    {
        "description": "validation of date-time strings",
        "schema": {"format": "date-time"},
        "tests": [
            {
                "description": "a valid date-time string",
                "data": "1963-06-19T08:30:06.283185Z",
                "valid": true
            },
            {
                "description": "a valid date-time string without second fraction",
                "data": "1963-06-19T08:30:06Z",
                "valid": true
            },
            {
                "description": "a valid date-time string with plus offset",
                "data": "1937-01-01T12:00:27.87+00:20",
                "valid": true
            },
            {
                "description": "a valid date-time string with minus offset",
                "data": "1990-12-31T15:59:50.123-08:00",
                "valid": true
            },
            {
                "description": "a invalid day in date-time string",
                "data": "1990-02-31T15:59:60.123-08:00",
                "valid": false
            },
            {
                "description": "an invalid offset in date-time string",
                "data": "1990-12-31T15:59:60-24:00",
                "valid": false
            },
            {
                "description": "an invalid closing Z after time-zone offset",
                "data": "1963-06-19T08:30:06.28123+01:00Z",
                "valid": false
            },            
            {
                "description": "an invalid date-time string",
                "data": "06/19/1963 08:30:06 PST",
                "valid": false
            },
            {
                "description": "case-insensitive T and Z",
                "data": "1963-06-19t08:30:06.283185z",
                "valid": true
            },
            {
                "description": "only RFC3339 not all of ISO 8601 are valid",
                "data": "2013-350T01:01:01",
                "valid": false
            }
        ]
    },
    {
        "description": "validation of URIs",
        "schema": {"format": "uri"},
        "tests": [
            {
                "description": "a valid URL with anchor tag",
                "data": "http://foo.bar/?baz=qux#quux",
                "valid": true
            },
            {
                "description": "a valid URL with anchor tag and parantheses",
                "data": "http://foo.com/blah_(wikipedia)_blah#cite-1",
                "valid": true
            },
            {
                "description": "a valid URL with URL-encoded stuff",
                "data": "http://foo.bar/?q=Test%20URL-encoded%20stuff",
                "valid": true
            },
            {
                "description": "a valid puny-coded URL ",
                "data": "http://xn--nw2a.xn--j6w193g/",
                "valid": true
            },
            {
                "description": "a valid URL with many special characters",
                "data": "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
                "valid": true
            },
            {
                "description": "a valid URL based on IPv4",
                "data": "http://223.255.255.254",
                "valid": true
            },
            {
                "description": "a valid URL with ftp scheme",
                "data": "ftp://ftp.is.co.za/rfc/rfc1808.txt",
                "valid": true
            },
            {
                "description": "a valid URL for a simple text file",
                "data": "http://www.ietf.org/rfc/rfc2396.txt",
                "valid": true
            },
            {
                "description": "a valid URL ",
                "data": "ldap://[2001:db8::7]/c=GB?objectClass?one",
                "valid": true
            },
            {
                "description": "a valid mailto URI",
                "data": "mailto:John.Doe@example.com",
                "valid": true
            },
            {
                "description": "a valid newsgroup URI",
                "data": "news:comp.infosystems.www.servers.unix",
                "valid": true
            },
            {
                "description": "a valid tel URI",
                "data": "tel:+1-816-555-1212",
                "valid": true
            },
            {
                "description": "a valid URN",
                "data": "urn:oasis:names:specification:docbook:dtd:xml:4.1.2",
                "valid": true
            },
            {
                "description": "an invalid protocol-relative URI Reference",
                "data": "//foo.bar/?baz=qux#quux",
                "valid": false
            },
            {
                "description": "an invalid relative URI Reference",
                "data": "/abc",
                "valid": false
            },
            {
                "description": "an invalid URI",
                "data": "\\\\WINDOWS\\fileshare",
                "valid": false
            },
            {
                "description": "an invalid URI though valid URI reference",
                "data": "abc",
                "valid": false
            },
            {
                "description": "an invalid URI with spaces",
                "data": "http:// shouldfail.com",
                "valid": false
            },
            {
                "description": "an invalid URI with spaces and missing scheme",
                "data": ":// should fail",
                "valid": false
            }
        ]
    },
    {
        "description": "validation of URI References",
        "schema": {"format": "uri-reference"},
        "tests": [
            {
                "description": "a valid URI",
                "data": "http://foo.bar/?baz=qux#quux",
                "valid": true
            },
            {
                "description": "a valid protocol-relative URI Reference",
                "data": "//foo.bar/?baz=qux#quux",
                "valid": true
            },
            {
                "description": "a valid relative URI Reference",
                "data": "/abc",
                "valid": true
            },
            {
                "description": "an invalid URI Reference",
                "data": "\\\\WINDOWS\\fileshare",
                "valid": false
            },
            {
                "description": "a valid URI Reference",
                "data": "abc",
                "valid": true
            },
            {
                "description": "a valid URI fragment",
                "data": "#fragment",
                "valid": true
            },
            {
                "description": "an invalid URI fragment",
                "data": "#frag\\ment",
                "valid": false
            }
        ]
    },
    {
        "description": "format: uri-template",
        "schema": {"format": "uri-template"},
        "tests": [
            {
                "description": "a valid uri-template",
                "data": "http://example.com/dictionary/{term:1}/{term}",
                "valid": true
            },
            {
                "description": "an invalid uri-template",
                "data": "http://example.com/dictionary/{term:1}/{term",
                "valid": false
            },
            {
                "description": "a valid uri-template without variables",
                "data": "http://example.com/dictionary",
                "valid": true
            },
            {
                "description": "a valid relative uri-template",
                "data": "dictionary/{term:1}/{term}",
                "valid": true
            }
        ]
    },
    {
        "description": "validation of e-mail addresses",
        "schema": {"format": "email"},
        "tests": [
            {
                "description": "a valid e-mail address",
                "data": "joe.bloggs@example.com",
                "valid": true
            },
            {
                "description": "an invalid e-mail address",
                "data": "2962",
                "valid": false
            }
        ]
    },
    {
        "description": "validation of IP addresses",
        "schema": {"format": "ipv4"},
        "tests": [
            {
                "description": "a valid IP address",
                "data": "192.168.0.1",
                "valid": true
            },
            {
                "description": "an IP address with too many components",
                "data": "127.0.0.0.1",
                "valid": false
            },
            {
                "description": "an IP address with out-of-range values",
                "data": "256.256.256.256",
                "valid": false
            },
            {
                "description": "an IP address without 4 components",
                "data": "127.0",
                "valid": false
            },
            {
                "description": "an IP address as an integer",
                "data": "0x7f000001",
                "valid": false
            }
        ]
    },
    {
        "description": "validation of IPv6 addresses",
        "schema": {"format": "ipv6"},
        "tests": [
            {
                "description": "a valid IPv6 address",
                "data": "::1",
                "valid": true
            },
            {
                "description": "an IPv6 address with out-of-range values",
                "data": "12345::",
                "valid": false
            },
            {
                "description": "an IPv6 address with too many components",
                "data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1",
                "valid": false
            },
            {
                "description": "an IPv6 address containing illegal characters",
                "data": "::laptop",
                "valid": false
            }
        ]
    },
    {
        "description": "validation of host names",
        "schema": {"format": "hostname"},
        "tests": [
            {
                "description": "a valid host name",
                "data": "www.example.com",
                "valid": true
            },
            {
                "description": "a host name starting with an illegal character",
                "data": "-a-host-name-that-starts-with--",
                "valid": false
            },
            {
                "description": "a host name containing illegal characters",
                "data": "not_a_valid_host_name",
                "valid": false
            },
            {
                "description": "a host name with a component too long",
                "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
                "valid": false
            }
        ]
    },
    {
        "description": "validation of JSON-pointers (JSON String Representation)",
        "schema": {"format": "json-pointer"},
        "tests": [
            {
                "description": "a valid JSON-pointer",
                "data": "/foo/bar~0/baz~1/%a",
                "valid": true
            },
            {
                "description": "not a valid JSON-pointer (~ not escaped)",
                "data": "/foo/bar~",
                "valid": false
            },
            {
                "description": "valid JSON-pointer with empty segment",
                "data": "/foo//bar",
                "valid": true
            },
            {
                "description": "valid JSON-pointer with the last empty segment",
                "data": "/foo/bar/",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #1",
                "data": "",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #2",
                "data": "/foo",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #3",
                "data": "/foo/0",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #4",
                "data": "/",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #5",
                "data": "/a~1b",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #6",
                "data": "/c%d",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #7",
                "data": "/e^f",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #8",
                "data": "/g|h",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #9",
                "data": "/i\\j",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #10",
                "data": "/k\"l",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #11",
                "data": "/ ",
                "valid": true
            },
            {
                "description": "valid JSON-pointer as stated in RFC 6901 #12",
                "data": "/m~0n",
                "valid": true
            },
            {
                "description": "valid JSON-pointer used adding to the last array position",
                "data": "/foo/-",
                "valid": true
            },
            {
                "description": "valid JSON-pointer (- used as object member name)",
                "data": "/foo/-/bar",
                "valid": true
            },
            {
                "description": "valid JSON-pointer (multiple escaped characters)",
                "data": "/~1~0~0~1~1",
                "valid": true
            },
            {
                "description": "valid JSON-pointer (escaped with fraction part) #1",
                "data": "/~1.1",
                "valid": true
            },
            {
                "description": "valid JSON-pointer (escaped with fraction part) #2",
                "data": "/~0.1",
                "valid": true
            },
            {
                "description": "not a valid JSON-pointer (URI Fragment Identifier) #1",
                "data": "#",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (URI Fragment Identifier) #2",
                "data": "#/",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (URI Fragment Identifier) #3",
                "data": "#a",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (some escaped, but not all) #1",
                "data": "/~0~",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (some escaped, but not all) #2",
                "data": "/~0/~",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (wrong escape character) #1",
                "data": "/~2",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (wrong escape character) #2",
                "data": "/~-1",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (multiple characters not escaped)",
                "data": "/~~",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (isn't empty nor starts with /) #1",
                "data": "a",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (isn't empty nor starts with /) #2",
                "data": "0",
                "valid": false
            },
            {
                "description": "not a valid JSON-pointer (isn't empty nor starts with /) #3",
                "data": "a/a",
                "valid": false
            }
        ]
    }
]