Debian Codegraph @

spec/JSON-Schema-Test-Suite/tests/draft2020-12/optional/format/duration.json

raw ◀ ▶
1 Debian patch touch this file
•1 [
2 {
3 "description": "validation of duration strings",
4 "schema": { "format": "duration" },
5 "tests": [
6 {
7 "description": "all string formats ignore integers",
8 "data": 12,
9 "valid": true
10 },
11 {
12 "description": "all string formats ignore floats",
13 "data": 13.7,
14 "valid": true
15 },
16 {
17 "description": "all string formats ignore objects",
18 "data": {},
19 "valid": true
20 },
21 {
22 "description": "all string formats ignore arrays",
23 "data": [],
24 "valid": true
25 },
26 {
27 "description": "all string formats ignore booleans",
28 "data": false,
29 "valid": true
30 },
31 {
32 "description": "all string formats ignore nulls",
33 "data": null,
34 "valid": true
35 },
36 {
37 "description": "a valid duration string",
38 "data": "P4DT12H30M5S",
39 "valid": true
40 },
41 {
42 "description": "an invalid duration string",
43 "data": "PT1D",
44 "valid": false
45 },
46 {
47 "description": "no elements present",
48 "data": "P",
49 "valid": false
50 },
51 {
52 "description": "no time elements present",
53 "data": "P1YT",
54 "valid": false
55 },
56 {
57 "description": "no date or time elements present",
58 "data": "PT",
59 "valid": false
60 },
61 {
62 "description": "elements out of order",
63 "data": "P2D1Y",
64 "valid": false
65 },
66 {
67 "description": "missing time separator",
68 "data": "P1D2H",
69 "valid": false
70 },
71 {
72 "description": "time element in the date position",
73 "data": "P2S",
74 "valid": false
75 },
76 {
77 "description": "four years duration",
78 "data": "P4Y",
79 "valid": true
80 },
81 {
82 "description": "zero time, in seconds",
83 "data": "PT0S",
84 "valid": true
85 },
86 {
87 "description": "zero time, in days",
88 "data": "P0D",
89 "valid": true
90 },
91 {
92 "description": "one month duration",
93 "data": "P1M",
94 "valid": true
95 },
96 {
97 "description": "one minute duration",
98 "data": "PT1M",
99 "valid": true
100 },
101 {
102 "description": "one and a half days, in hours",
103 "data": "PT36H",
104 "valid": true
105 },
106 {
107 "description": "one and a half days, in days and hours",
108 "data": "P1DT12H",
109 "valid": true
110 },
111 {
112 "description": "two weeks",
113 "data": "P2W",
114 "valid": true
115 },
116 {
117 "description": "weeks cannot be combined with other units",
118 "data": "P1Y2W",
119 "valid": false
120 },
121 {
122 "description": "non-ascii digits should be rejected",
123 "data": "P২Y",
124 "valid": false
125 }
126 ]
127 }
128 ]