| 1 |
[ |
| 2 |
{ |
| 3 |
"description": "validation of date-time strings", |
| 4 |
"schema": { |
| 5 |
"$schema": "https://json-schema.org/draft/2019-09/schema", |
| 6 |
"format": "date-time" |
| 7 |
}, |
| 8 |
"skip": { |
| 9 |
"v3-roundtrip": "generation only supported in version https://json-schema.org/draft/2020-12/schema" |
| 10 |
}, |
| 11 |
"tests": [ |
| 12 |
{ |
| 13 |
"description": "all string formats ignore integers", |
| 14 |
"data": 12, |
| 15 |
"valid": true, |
| 16 |
"skip": { |
| 17 |
"v3-roundtrip": "could not extract schema" |
| 18 |
} |
| 19 |
}, |
| 20 |
{ |
| 21 |
"description": "all string formats ignore floats", |
| 22 |
"data": 13.7, |
| 23 |
"valid": true, |
| 24 |
"skip": { |
| 25 |
"v3-roundtrip": "could not extract schema" |
| 26 |
} |
| 27 |
}, |
| 28 |
{ |
| 29 |
"description": "all string formats ignore objects", |
| 30 |
"data": {}, |
| 31 |
"valid": true, |
| 32 |
"skip": { |
| 33 |
"v3-roundtrip": "could not extract schema" |
| 34 |
} |
| 35 |
}, |
| 36 |
{ |
| 37 |
"description": "all string formats ignore arrays", |
| 38 |
"data": [], |
| 39 |
"valid": true, |
| 40 |
"skip": { |
| 41 |
"v3-roundtrip": "could not extract schema" |
| 42 |
} |
| 43 |
}, |
| 44 |
{ |
| 45 |
"description": "all string formats ignore booleans", |
| 46 |
"data": false, |
| 47 |
"valid": true, |
| 48 |
"skip": { |
| 49 |
"v3-roundtrip": "could not extract schema" |
| 50 |
} |
| 51 |
}, |
| 52 |
{ |
| 53 |
"description": "all string formats ignore nulls", |
| 54 |
"data": null, |
| 55 |
"valid": true, |
| 56 |
"skip": { |
| 57 |
"v3-roundtrip": "could not extract schema" |
| 58 |
} |
| 59 |
}, |
| 60 |
{ |
| 61 |
"description": "a valid date-time string", |
| 62 |
"data": "1963-06-19T08:30:06.283185Z", |
| 63 |
"valid": true, |
| 64 |
"skip": { |
| 65 |
"v3-roundtrip": "could not extract schema" |
| 66 |
} |
| 67 |
}, |
| 68 |
{ |
| 69 |
"description": "a valid date-time string without second fraction", |
| 70 |
"data": "1963-06-19T08:30:06Z", |
| 71 |
"valid": true, |
| 72 |
"skip": { |
| 73 |
"v3-roundtrip": "could not extract schema" |
| 74 |
} |
| 75 |
}, |
| 76 |
{ |
| 77 |
"description": "a valid date-time string with plus offset", |
| 78 |
"data": "1937-01-01T12:00:27.87+00:20", |
| 79 |
"valid": true, |
| 80 |
"skip": { |
| 81 |
"v3-roundtrip": "could not extract schema" |
| 82 |
} |
| 83 |
}, |
| 84 |
{ |
| 85 |
"description": "a valid date-time string with minus offset", |
| 86 |
"data": "1990-12-31T15:59:50.123-08:00", |
| 87 |
"valid": true, |
| 88 |
"skip": { |
| 89 |
"v3-roundtrip": "could not extract schema" |
| 90 |
} |
| 91 |
}, |
| 92 |
{ |
| 93 |
"description": "a valid date-time with a leap second, UTC", |
| 94 |
"data": "1998-12-31T23:59:60Z", |
| 95 |
"valid": true, |
| 96 |
"skip": { |
| 97 |
"v3": "6 errors in empty disjunction:\nconflicting values \"1998-12-31T23:59:60Z\" and [...] (mismatched types string and list):\n generated.cue:5:1\n generated.cue:5:36\n instance.json:1:1\nconflicting values \"1998-12-31T23:59:60Z\" and bool (mismatched types string and bool):\n generated.cue:5:1\n generated.cue:5:8\n instance.json:1:1\nconflicting values \"1998-12-31T23:59:60Z\" and null (mismatched types string and null):\n generated.cue:5:1\n instance.json:1:1\nconflicting values \"1998-12-31T23:59:60Z\" and number (mismatched types string and number):\n generated.cue:5:1\n generated.cue:5:15\n instance.json:1:1\nconflicting values \"1998-12-31T23:59:60Z\" and {...} (mismatched types string and struct):\n generated.cue:5:1\n generated.cue:5:44\n instance.json:1:1\ninvalid value \"1998-12-31T23:59:60Z\" (does not satisfy time.Time): error in call to time.Time: invalid time \"1998-12-31T23:59:60Z\":\n generated.cue:1:1\n instance.json:1:1\n", |
| 98 |
"v3-roundtrip": "could not extract schema" |
| 99 |
} |
| 100 |
}, |
| 101 |
{ |
| 102 |
"description": "a valid date-time with a leap second, with minus offset", |
| 103 |
"data": "1998-12-31T15:59:60.123-08:00", |
| 104 |
"valid": true, |
| 105 |
"skip": { |
| 106 |
"v3": "6 errors in empty disjunction:\nconflicting values \"1998-12-31T15:59:60.123-08:00\" and [...] (mismatched types string and list):\n generated.cue:5:1\n generated.cue:5:36\n instance.json:1:1\nconflicting values \"1998-12-31T15:59:60.123-08:00\" and bool (mismatched types string and bool):\n generated.cue:5:1\n generated.cue:5:8\n instance.json:1:1\nconflicting values \"1998-12-31T15:59:60.123-08:00\" and null (mismatched types string and null):\n generated.cue:5:1\n instance.json:1:1\nconflicting values \"1998-12-31T15:59:60.123-08:00\" and number (mismatched types string and number):\n generated.cue:5:1\n generated.cue:5:15\n instance.json:1:1\nconflicting values \"1998-12-31T15:59:60.123-08:00\" and {...} (mismatched types string and struct):\n generated.cue:5:1\n generated.cue:5:44\n instance.json:1:1\ninvalid value \"1998-12-31T15:59:60.123-08:00\" (does not satisfy time.Time): error in call to time.Time: invalid time \"1998-12-31T15:59:60.123-08:00\":\n generated.cue:1:1\n instance.json:1:1\n", |
| 107 |
"v3-roundtrip": "could not extract schema" |
| 108 |
} |
| 109 |
}, |
| 110 |
{ |
| 111 |
"description": "an invalid date-time past leap second, UTC", |
| 112 |
"data": "1998-12-31T23:59:61Z", |
| 113 |
"valid": false, |
| 114 |
"skip": { |
| 115 |
"v3-roundtrip": "could not extract schema" |
| 116 |
} |
| 117 |
}, |
| 118 |
{ |
| 119 |
"description": "an invalid date-time with leap second on a wrong minute, UTC", |
| 120 |
"data": "1998-12-31T23:58:60Z", |
| 121 |
"valid": false, |
| 122 |
"skip": { |
| 123 |
"v3-roundtrip": "could not extract schema" |
| 124 |
} |
| 125 |
}, |
| 126 |
{ |
| 127 |
"description": "an invalid date-time with leap second on a wrong hour, UTC", |
| 128 |
"data": "1998-12-31T22:59:60Z", |
| 129 |
"valid": false, |
| 130 |
"skip": { |
| 131 |
"v3-roundtrip": "could not extract schema" |
| 132 |
} |
| 133 |
}, |
| 134 |
{ |
| 135 |
"description": "an invalid day in date-time string", |
| 136 |
"data": "1990-02-31T15:59:59.123-08:00", |
| 137 |
"valid": false, |
| 138 |
"skip": { |
| 139 |
"v3-roundtrip": "could not extract schema" |
| 140 |
} |
| 141 |
}, |
| 142 |
{ |
| 143 |
"description": "an invalid offset in date-time string", |
| 144 |
"data": "1990-12-31T15:59:59-24:00", |
| 145 |
"valid": false, |
| 146 |
"skip": { |
| 147 |
"v3": "unexpected success", |
| 148 |
"v3-roundtrip": "could not extract schema" |
| 149 |
} |
| 150 |
}, |
| 151 |
{ |
| 152 |
"description": "an invalid closing Z after time-zone offset", |
| 153 |
"data": "1963-06-19T08:30:06.28123+01:00Z", |
| 154 |
"valid": false, |
| 155 |
"skip": { |
| 156 |
"v3-roundtrip": "could not extract schema" |
| 157 |
} |
| 158 |
}, |
| 159 |
{ |
| 160 |
"description": "an invalid date-time string", |
| 161 |
"data": "06/19/1963 08:30:06 PST", |
| 162 |
"valid": false, |
| 163 |
"skip": { |
| 164 |
"v3-roundtrip": "could not extract schema" |
| 165 |
} |
| 166 |
}, |
| 167 |
{ |
| 168 |
"description": "case-insensitive T and Z", |
| 169 |
"data": "1963-06-19t08:30:06.283185z", |
| 170 |
"valid": true, |
| 171 |
"skip": { |
| 172 |
"v3": "6 errors in empty disjunction:\nconflicting values \"1963-06-19t08:30:06.283185z\" and [...] (mismatched types string and list):\n generated.cue:5:1\n generated.cue:5:36\n instance.json:1:1\nconflicting values \"1963-06-19t08:30:06.283185z\" and bool (mismatched types string and bool):\n generated.cue:5:1\n generated.cue:5:8\n instance.json:1:1\nconflicting values \"1963-06-19t08:30:06.283185z\" and null (mismatched types string and null):\n generated.cue:5:1\n instance.json:1:1\nconflicting values \"1963-06-19t08:30:06.283185z\" and number (mismatched types string and number):\n generated.cue:5:1\n generated.cue:5:15\n instance.json:1:1\nconflicting values \"1963-06-19t08:30:06.283185z\" and {...} (mismatched types string and struct):\n generated.cue:5:1\n generated.cue:5:44\n instance.json:1:1\ninvalid value \"1963-06-19t08:30:06.283185z\" (does not satisfy time.Time): error in call to time.Time: invalid time \"1963-06-19t08:30:06.283185z\":\n generated.cue:1:1\n instance.json:1:1\n", |
| 173 |
"v3-roundtrip": "could not extract schema" |
| 174 |
} |
| 175 |
}, |
| 176 |
{ |
| 177 |
"description": "only RFC3339 not all of ISO 8601 are valid", |
| 178 |
"data": "2013-350T01:01:01", |
| 179 |
"valid": false, |
| 180 |
"skip": { |
| 181 |
"v3-roundtrip": "could not extract schema" |
| 182 |
} |
| 183 |
}, |
| 184 |
{ |
| 185 |
"description": "invalid non-padded month dates", |
| 186 |
"data": "1963-6-19T08:30:06.283185Z", |
| 187 |
"valid": false, |
| 188 |
"skip": { |
| 189 |
"v3-roundtrip": "could not extract schema" |
| 190 |
} |
| 191 |
}, |
| 192 |
{ |
| 193 |
"description": "invalid non-padded day dates", |
| 194 |
"data": "1963-06-1T08:30:06.283185Z", |
| 195 |
"valid": false, |
| 196 |
"skip": { |
| 197 |
"v3-roundtrip": "could not extract schema" |
| 198 |
} |
| 199 |
}, |
| 200 |
{ |
| 201 |
"description": "invalid non-ASCII '৪' (a Bengali 4) in date portion", |
| 202 |
"data": "1963-06-1৪T00:00:00Z", |
| 203 |
"valid": false, |
| 204 |
"skip": { |
| 205 |
"v3-roundtrip": "could not extract schema" |
| 206 |
} |
| 207 |
}, |
| 208 |
{ |
| 209 |
"description": "invalid non-ASCII '৪' (a Bengali 4) in time portion", |
| 210 |
"data": "1963-06-11T0৪:00:00Z", |
| 211 |
"valid": false, |
| 212 |
"skip": { |
| 213 |
"v3-roundtrip": "could not extract schema" |
| 214 |
} |
| 215 |
} |
| 216 |
] |
| 217 |
} |
| 218 |
] |