Commit e4483d8
Fix MinLength incorrectly added to DateTime and Date types
When a DateTime, DateTimeOffset, DateOnly, or TimeOnly property has
[Required], it was getting MinLength=1 because these types are
represented as strings with a format in JSON Schema. This is incorrect -
MinLength should only apply to actual string properties, not date/time
types that use string representation.
Added IsDateTimeFormat check to exclude date-time, date, time, duration,
and time-span formats from the MinLength=1 logic.
Fixes #1583
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent e6a278b commit e4483d8
2 files changed
Lines changed: 40 additions & 1 deletion
File tree
- src
- NJsonSchema.Tests/Generation
- NJsonSchema/Generation
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 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 | + | |
302 | 334 | | |
303 | 335 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1205 | 1205 | | |
1206 | 1206 | | |
1207 | 1207 | | |
1208 | | - | |
| 1208 | + | |
| 1209 | + | |
1209 | 1210 | | |
1210 | 1211 | | |
1211 | 1212 | | |
| |||
1306 | 1307 | | |
1307 | 1308 | | |
1308 | 1309 | | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
1309 | 1316 | | |
1310 | 1317 | | |
1311 | 1318 | | |
| |||
0 commit comments