Debian Codegraph @

ajv-formats/tests/extras/format.json

raw symbols SCIP
1 [
2 {
3 "description": "format: regex",
4 "schema": {
5 "format": "regex"
6 },
7 "tests": [
8 {
9 "description": "valid regex",
10 "data": "[0-9]",
11 "valid": true
12 },
13 {
14 "description": "invalid regex",
15 "data": "[9-0]",
16 "valid": false
17 },
18 {
19 "description": "not string is valid",
20 "data": 123,
21 "valid": true
22 }
23 ]
24 },
25 {
26 "description": "format: uri",
27 "schema": {
28 "format": "uri"
29 },
30 "tests": [
31 {
32 "description": "valid uri",
33 "data": "urn:isbn:978-3-531-18621-4",
34 "valid": true
35 },
36 {
37 "description": "invalid relative uri-reference",
38 "data": "/abc",
39 "valid": false
40 }
41 ]
42 },
43 {
44 "description": "format: uri-template",
45 "schema": {
46 "format": "uri-template"
47 },
48 "tests": [
49 {
50 "description": "valid uri-template",
51 "data": "http://example.com/dictionary/{term:1}/{term}",
52 "valid": true
53 },
54 {
55 "description": "invalid uri-template",
56 "data": "http://example.com/dictionary/{term:1}/{term",
57 "valid": false
58 }
59 ]
60 },
61 {
62 "description": "format: hostname",
63 "schema": {
64 "format": "hostname"
65 },
66 "tests": [
67 {
68 "description": "valid hostname",
69 "data": "123.example.com",
70 "valid": true
71 },
72 {
73 "description": "valid hostname - trailing dot",
74 "data": "123.example.com.",
75 "valid": true
76 },
77 {
78 "description": "valid hostname - single label",
79 "data": "localhost",
80 "valid": true
81 },
82 {
83 "description": "valid hostname - single label with trailing dot",
84 "data": "localhost.",
85 "valid": true
86 },
87 {
88 "description": "valid hostname #312",
89 "data": "lead-routing-qa.lvuucj.0001.use1.cache.amazonaws.com",
90 "valid": true
91 },
92 {
93 "description": "valid hostname - maximum length label (63 chars)",
94 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.example.com",
95 "valid": true
96 },
97 {
98 "description": "invalid hostname - label too long (64 chars)",
99 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.example.com",
100 "valid": false
101 },
102 {
103 "description": "valid hostname - maximum length hostname (255 octets)",
104 "data": "abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxy.example.com",
105 "valid": true
106 },
107 {
108 "description": "valid hostname - maximum length hostname (255 octets) with trailing dot",
109 "data": "abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxy.example.com.",
110 "valid": true
111 },
112 {
113 "description": "invalid hostname - hostname too long (256 octets)",
114 "data": "abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.example.com",
115 "valid": false
116 },
117 {
118 "description": "invalid hostname - hostname too long (256 octets) with trailing dot",
119 "data": "abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.abcdefghijklmnopqrstuvwxyz.example.com.",
120 "valid": false
121 }
122 ]
123 },
124 {
125 "description": "validation of URL strings",
126 "schema": {"format": "url"},
127 "tests": [
128 {
129 "data": "http://foo.com/blah_blah",
130 "description": "a valid URL string",
131 "valid": true
132 },
133 {
134 "data": "http://foo.com/blah_blah/",
135 "description": "a valid URL string",
136 "valid": true
137 },
138 {
139 "data": "http://foo.com/blah_blah_(wikipedia)",
140 "description": "a valid URL string",
141 "valid": true
142 },
143 {
144 "data": "http://foo.com/blah_blah_(wikipedia)_(again)",
145 "description": "a valid URL string",
146 "valid": true
147 },
148 {
149 "data": "http://www.example.com/wpstyle/?p=364",
150 "description": "a valid URL string",
151 "valid": true
152 },
153 {
154 "data": "https://www.example.com/foo/?bar=baz&inga=42&quux",
155 "description": "a valid URL string",
156 "valid": true
157 },
158 {
159 "data": "http://✪df.ws/123",
160 "description": "a valid URL string",
161 "valid": true
162 },
163 {
164 "data": "http://userid:[email protected]:8080",
165 "description": "a valid URL string",
166 "valid": true
167 },
168 {
169 "data": "http://userid:[email protected]:8080/",
170 "description": "a valid URL string",
171 "valid": true
172 },
173 {
174 "data": "http://[email protected]",
175 "description": "a valid URL string",
176 "valid": true
177 },
178 {
179 "data": "http://[email protected]/",
180 "description": "a valid URL string",
181 "valid": true
182 },
183 {
184 "data": "http://[email protected]:8080",
185 "description": "a valid URL string",
186 "valid": true
187 },
188 {
189 "data": "http://[email protected]:8080/",
190 "description": "a valid URL string",
191 "valid": true
192 },
193 {
194 "data": "http://userid:[email protected]",
195 "description": "a valid URL string",
196 "valid": true
197 },
198 {
199 "data": "http://userid:[email protected]/",
200 "description": "a valid URL string",
201 "valid": true
202 },
203 {
204 "data": "http://142.42.1.1/",
205 "description": "a valid URL string",
206 "valid": true
207 },
208 {
209 "data": "http://142.42.1.1:8080/",
210 "description": "a valid URL string",
211 "valid": true
212 },
213 {
214 "data": "http://➡.ws/䨹",
215 "description": "a valid URL string",
216 "valid": true
217 },
218 {
219 "data": "http://⌘.ws",
220 "description": "a valid URL string",
221 "valid": true
222 },
223 {
224 "data": "http://⌘.ws/",
225 "description": "a valid URL string",
226 "valid": true
227 },
228 {
229 "data": "http://foo.com/blah_(wikipedia)#cite-1",
230 "description": "a valid URL string",
231 "valid": true
232 },
233 {
234 "data": "http://foo.com/blah_(wikipedia)_blah#cite-1",
235 "description": "a valid URL string",
236 "valid": true
237 },
238 {
239 "data": "http://foo.com/unicode_(✪)_in_parens",
240 "description": "a valid URL string",
241 "valid": true
242 },
243 {
244 "data": "http://foo.com/(something)?after=parens",
245 "description": "a valid URL string",
246 "valid": true
247 },
248 {
249 "data": "http://☺.damowmow.com/",
250 "description": "a valid URL string",
251 "valid": true
252 },
253 {
254 "data": "http://code.google.com/events/#&product=browser",
255 "description": "a valid URL string",
256 "valid": true
257 },
258 {
259 "data": "http://j.mp",
260 "description": "a valid URL string",
261 "valid": true
262 },
263 {
264 "data": "ftp://foo.bar/baz",
265 "description": "a valid URL string",
266 "valid": true
267 },
268 {
269 "data": "http://foo.bar/?q=Test%20URL-encoded%20stuff",
270 "description": "a valid URL string",
271 "valid": true
272 },
273 {
274 "data": "http://مثال.إختبار",
275 "description": "a valid URL string",
276 "valid": true
277 },
278 {
279 "data": "http://例子.测试",
280 "description": "a valid URL string",
281 "valid": true
282 },
283 {
284 "data": "http://उदाहरण.परीक्षा",
285 "description": "a valid URL string",
286 "valid": true
287 },
288 {
289 "data": "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
290 "description": "a valid URL string",
291 "valid": true
292 },
293 {
294 "data": "http://1337.net",
295 "description": "a valid URL string",
296 "valid": true
297 },
298 {
299 "data": "http://a.b-c.de",
300 "description": "a valid URL string",
301 "valid": true
302 },
303 {
304 "data": "http://223.255.255.254",
305 "description": "a valid URL string",
306 "valid": true
307 },
308 {
309 "data": "http://",
310 "description": "an invalid URL string",
311 "valid": false
312 },
313 {
314 "data": "http://.",
315 "description": "an invalid URL string",
316 "valid": false
317 },
318 {
319 "data": "http://..",
320 "description": "an invalid URL string",
321 "valid": false
322 },
323 {
324 "data": "http://../",
325 "description": "an invalid URL string",
326 "valid": false
327 },
328 {
329 "data": "http://?",
330 "description": "an invalid URL string",
331 "valid": false
332 },
333 {
334 "data": "http://??",
335 "description": "an invalid URL string",
336 "valid": false
337 },
338 {
339 "data": "http://??/",
340 "description": "an invalid URL string",
341 "valid": false
342 },
343 {
344 "data": "http://#",
345 "description": "an invalid URL string",
346 "valid": false
347 },
348 {
349 "data": "http://##",
350 "description": "an invalid URL string",
351 "valid": false
352 },
353 {
354 "data": "http://##/",
355 "description": "an invalid URL string",
356 "valid": false
357 },
358 {
359 "data": "http://foo.bar?q=Spaces should be encoded",
360 "description": "an invalid URL string",
361 "valid": false
362 },
363 {
364 "data": "//",
365 "description": "an invalid URL string",
366 "valid": false
367 },
368 {
369 "data": "//a",
370 "description": "an invalid URL string",
371 "valid": false
372 },
373 {
374 "data": "///a",
375 "description": "an invalid URL string",
376 "valid": false
377 },
378 {
379 "data": "///",
380 "description": "an invalid URL string",
381 "valid": false
382 },
383 {
384 "data": "http:///a",
385 "description": "an invalid URL string",
386 "valid": false
387 },
388 {
389 "data": "foo.com",
390 "description": "an invalid URL string",
391 "valid": false
392 },
393 {
394 "data": "rdar://1234",
395 "description": "an invalid URL string",
396 "valid": false
397 },
398 {
399 "data": "h://test",
400 "description": "an invalid URL string",
401 "valid": false
402 },
403 {
404 "data": "http:// shouldfail.com",
405 "description": "an invalid URL string",
406 "valid": false
407 },
408 {
409 "data": ":// should fail",
410 "description": "an invalid URL string",
411 "valid": false
412 },
413 {
414 "data": "http://foo.bar/foo(bar)baz quux",
415 "description": "an invalid URL string",
416 "valid": false
417 },
418 {
419 "data": "ftps://foo.bar/",
420 "description": "an invalid URL string",
421 "valid": false
422 },
423 {
424 "data": "http://-error-.invalid/",
425 "description": "an invalid URL string",
426 "valid": false
427 },
428 {
429 "data": "http://a.b--c.de/",
430 "description": "an invalid URL string",
431 "valid": false
432 },
433 {
434 "data": "http://-a.b.co",
435 "description": "an invalid URL string",
436 "valid": false
437 },
438 {
439 "data": "http://a.b-.co",
440 "description": "an invalid URL string",
441 "valid": false
442 },
443 {
444 "data": "http://0.0.0.0",
445 "description": "an invalid URL string",
446 "valid": false
447 },
448 {
449 "data": "http://10.1.1.0",
450 "description": "an invalid URL string",
451 "valid": false
452 },
453 {
454 "data": "http://10.1.1.255",
455 "description": "an invalid URL string",
456 "valid": false
457 },
458 {
459 "data": "http://224.1.1.1",
460 "description": "an invalid URL string",
461 "valid": false
462 },
463 {
464 "data": "http://1.1.1.1.1",
465 "description": "an invalid URL string",
466 "valid": false
467 },
468 {
469 "data": "http://123.123.123",
470 "description": "an invalid URL string",
471 "valid": false
472 },
473 {
474 "data": "http://3628126748",
475 "description": "an invalid URL string",
476 "valid": false
477 },
478 {
479 "data": "http://.www.foo.bar/",
480 "description": "an invalid URL string",
481 "valid": false
482 },
483 {
484 "data": "http://www.foo.bar./",
485 "description": "an invalid URL string",
486 "valid": false
487 },
488 {
489 "data": "http://.www.foo.bar./",
490 "description": "an invalid URL string",
491 "valid": false
492 },
493 {
494 "data": "http://10.1.1.1",
495 "description": "an invalid URL string",
496 "valid": false
497 },
498 {
499 "data": "http://10.1.1.254",
500 "description": "an invalid URL string",
501 "valid": false
502 }
503 ]
504 },
505 {
506 "description": "validation of date strings",
507 "schema": {"format": "date"},
508 "tests": [
509 {
510 "description": "a valid date string",
511 "data": "1963-06-19",
512 "valid": true
513 },
514 {
515 "description": "an invalid date string",
516 "data": "06/19/1963",
517 "valid": false
518 },
519 {
520 "description": "only RFC3339 not all of ISO 8601 are valid",
521 "data": "2013-350",
522 "valid": false
523 }
524 ]
525 },
526 {
527 "description": "validation of iso-time strings",
528 "schema": {"format": "iso-time"},
529 "tests": [
530 {
531 "description": "a valid iso-time",
532 "data": "12:34:56",
533 "valid": true
534 },
535 {
536 "description": "a valid iso-time with milliseconds",
537 "data": "12:34:56.789",
538 "valid": true
539 },
540 {
541 "description": "a valid iso-time with timezone",
542 "data": "12:34:56+01:00",
543 "valid": true
544 },
545 {
546 "description": "an invalid iso-time format",
547 "data": "12.34.56",
548 "valid": false
549 },
550 {
551 "description": "an invalid iso-time",
552 "data": "12:34:67",
553 "valid": false
554 },
555 {
556 "description": "a valid iso-time (leap second)",
557 "data": "23:59:60",
558 "valid": true
559 }
560 ]
561 },
562 {
563 "description": "validation of date-time strings",
564 "schema": {"format": "iso-date-time"},
565 "tests": [
566 {
567 "description": "a valid iso-date-time string",
568 "data": "1963-06-19T12:13:14Z",
569 "valid": true
570 },
571 {
572 "description": "a valid iso-date-time string without timezone",
573 "data": "1963-06-19T12:13:14",
574 "valid": true
575 },
576 {
577 "description": "an invalid iso-date-time string (no time)",
578 "data": "1963-06-19",
579 "valid": false
580 },
581 {
582 "description": "an invalid date-time string (additional part)",
583 "data": "1963-06-19T12:13:14ZTinvalid",
584 "valid": false
585 },
586 {
587 "description": "an invalid iso-date-time string (invalid date)",
588 "data": "1963-20-19T12:13:14Z",
589 "valid": false
590 },
591 {
592 "description": "an invalid iso-date-time string (invalid time)",
593 "data": "1963-06-19T12:13:67Z",
594 "valid": false
595 },
596 {
597 "description": "a valid iso-date-time string (leap second)",
598 "data": "2016-12-31T23:59:60Z",
599 "valid": true
600 }
601 ]
602 },
603 {
604 "description": "validation of uuid strings",
605 "schema": {"format": "uuid"},
606 "tests": [
607 {
608 "description": "a valid uuid",
609 "data": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
610 "valid": true
611 },
612 {
613 "description": "a valid uuid with uri prefix",
614 "data": "urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
615 "valid": true
616 },
617 {
618 "description": "not valid uuid",
619 "data": "f81d4fae7dec11d0a76500a0c91e6bf6",
620 "valid": false
621 }
622 ]
623 },
624 {
625 "description": "validation of JSON-pointer strings",
626 "schema": {"format": "json-pointer"},
627 "tests": [
628 {
629 "description": "a valid JSON-pointer",
630 "data": "/foo/bar~0/baz~1/%a",
631 "valid": true
632 },
633 {
634 "description": "empty string is valid",
635 "data": "",
636 "valid": true
637 },
638 {
639 "description": "/ is valid",
640 "data": "/",
641 "valid": true
642 },
643 {
644 "description": "not a valid JSON-pointer (~ not escaped)",
645 "data": "/foo/bar~",
646 "valid": false
647 },
648 {
649 "description": "valid JSON-pointer with empty segment",
650 "data": "/foo//bar",
651 "valid": true
652 },
653 {
654 "description": "valid JSON-pointer with the last empty segment",
655 "data": "/foo/bar/",
656 "valid": true
657 }
658 ]
659 },
660 {
661 "description": "validation of JSON-pointer URI fragment strings",
662 "schema": {"format": "json-pointer-uri-fragment"},
663 "tests": [
664 {
665 "description": "a valid JSON-pointer as uri fragment",
666 "data": "#/foo/%25a",
667 "valid": true
668 },
669 {
670 "description": "not a valid JSON-pointer as uri fragment (% not URL-encoded)",
671 "data": "#/foo/%a",
672 "valid": false
673 },
674 {
675 "description": "valid JSON-pointer with empty segment as uri fragment",
676 "data": "#/foo//bar",
677 "valid": true
678 },
679 {
680 "description": "valid JSON-pointer with the last empty segment as uri fragment",
681 "data": "#/foo/bar/",
682 "valid": true
683 }
684 ]
685 },
686 {
687 "description": "validation of relative JSON-pointer strings",
688 "schema": {"format": "relative-json-pointer"},
689 "tests": [
690 {
691 "description": "a valid relative JSON-pointer",
692 "data": "1/foo/bar~0/baz~1/%a",
693 "valid": true
694 },
695 {
696 "description": "a valid relative JSON-pointer with #",
697 "data": "2#",
698 "valid": true
699 },
700 {
701 "description": "parent reference is valid",
702 "data": "1",
703 "valid": true
704 },
705 {
706 "description": "empty string is invalid",
707 "data": "",
708 "valid": false
709 },
710 {
711 "description": "not a valid relative JSON-pointer (~ not escaped)",
712 "data": "1/foo/bar~",
713 "valid": false
714 },
715 {
716 "description": "not a valid relative JSON-pointer (leading 0)",
717 "data": "01/foo",
718 "valid": false
719 },
720 {
721 "description": "not a valid relative JSON-pointer with # (leading 0)",
722 "data": "02#",
723 "valid": false
724 },
725 {
726 "description": "valid relative JSON-pointer with empty segment",
727 "data": "1/foo//bar",
728 "valid": true
729 },
730 {
731 "description": "valid relative JSON-pointer with the last empty segment",
732 "data": "1/foo/bar/",
733 "valid": true
734 }
735 ]
736 },
737 {
738 "description": "validation of Byte",
739 "schema": {"format": "byte"},
740 "tests": [
741 {
742 "description": "'hello world' encoded in base64",
743 "data": "aGVsbG8gd29ybGQ=",
744 "valid": true
745 },
746 {
747 "description": "multiline base64",
748 "data": "VGhpcyBpcyBhIGJhc2U2NCBtdWx0aWxpbmUgc3RyaW5nIHRoYXQgc3BhbnMgbW9yZSB0aGFuIDc2\nIGNoYXJhY3RlcnMgdG8gdGVzdCBtdWx0aWxpbmUgY2FwYWJpbGl0aWVzCg==",
749 "valid": true
750 },
751 {
752 "description": "second round multiline base64",
753 "data": "VGhpcyBpcyBhIGJhc2U2NCBtdWx0aWxpbmUgc3RyaW5nIHRoYXQgc3BhbnMgbW9yZSB0aGFuIDc2\nIGNoYXJhY3RlcnMgdG8gdGVzdCBtdWx0aWxpbmUgY2FwYWJpbGl0aWVzCg==",
754 "valid": true
755 },
756 {
757 "description": "Invalid base64",
758 "data": "aGVsbG8gd29ybG=",
759 "valid": false
760 }
761 ]
762 },
763 {
764 "description": "validation of int32",
765 "schema": {"type": "number", "format": "int32"},
766 "tests": [
767 {
768 "description": "256 is ok",
769 "data": 256,
770 "valid": true
771 },
772 {
773 "description": "256.1 fails",
774 "data": 256.1,
775 "valid": false
776 },
777 {
778 "description": "-(2**31) is ok",
779 "data": -2147483648,
780 "valid": true
781 },
782 {
783 "description": "-(2**31) - 1 fails",
784 "data": -2147483649,
785 "valid": false
786 },
787 {
788 "description": "(2**31)-1 is ok",
789 "data": 2147483647,
790 "valid": true
791 },
792 {
793 "description": "2**31 fails",
794 "data": 2147483648,
795 "valid": false
796 },
797 {
798 "description": "non-numeric fails",
799 "data": "x",
800 "valid": false
801 }
802 ]
803 },
804 {
805 "description": "validation of int64",
806 "schema": {"type": "number", "format": "int64"},
807 "tests": [
808 {
809 "description": "256 is ok",
810 "data": 256,
811 "valid": true
812 },
813 {
814 "description": "float fails",
815 "data": 256.1,
816 "valid": false
817 },
818 {
819 "description": "non-numeric fails",
820 "data": "x",
821 "valid": false
822 }
823 ]
824 },
825 {
826 "description": "validation of float",
827 "schema": {"type": "number", "format": "float"},
828 "tests": [
829 {
830 "description": "256.1 is ok",
831 "data": 256.1,
832 "valid": true
833 },
834 {
835 "description": "non-numeric fails",
836 "data": "x",
837 "valid": false
838 }
839 ]
840 },
841 {
842 "description": "validation of double",
843 "schema": {"type": "number", "format": "double"},
844 "tests": [
845 {
846 "description": "256.1 is ok",
847 "data": 256.1,
848 "valid": true
849 },
850 {
851 "description": "non-numeric fails",
852 "data": "x",
853 "valid": false
854 }
855 ]
856 },
857 {
858 "description": "validation of password",
859 "schema": {"format": "password"},
860 "tests": [
861 {
862 "description": "'password string' is ok",
863 "data": "password string",
864 "valid": true
865 }
866 ]
867 },
868 {
869 "description": "validation of binary",
870 "schema": {"format": "binary"},
871 "tests": [
872 {
873 "description": "'binary string' is ok",
874 "data": "binary string",
875 "valid": true
876 }
877 ]
878 }
879 ]