Repository navigation
Commit b9823f2
[repo-assist] fix: formatObject correctly handles Option(T) elements in arrays (#475)
* fix: formatObject correctly handles Option<T> elements in arrays
When a generated API type has a property of type `Option<DateOnly>[]`,
`Option<TimeOnly>[]`, or `Option<string>[]`, the previous `appendFormattedArray`
helper fell through to `obj.ToString()` for each element, producing
locale-specific output like `Some(07/04/2025)` instead of ISO 8601.
Fix: detect when the array element type is an F# option type (pre-computed
`isOptionEl` flag) and unwrap each element using the cached tag reader and
Value property (same caches used elsewhere in the file). The inner value is
then formatted via `appendFormattedValue`, which correctly handles
DateOnly/TimeOnly (ISO 8601), strings (quoted), and all other types.
Add 6 new tests covering:
- `array<Option<DateOnly>>` with Some and None elements
- `array<Option<TimeOnly>>` with Some and None elements
- `array<Option<string>>` with Some and None elements
Total tests: 540 → 547.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* fix: make appendFormattedArray recursive for nested option arrays
* Hoist option cache lookups out of element loop in appendFormattedArray
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sergey Tihon <sergey.tihon@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>1 parent 0f2807a commit b9823f2
2 files changed
Lines changed: 72 additions & 1 deletion
File tree
- src/SwaggerProvider.Runtime
- tests/SwaggerProvider.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
388 | 407 | | |
389 | 408 | | |
390 | 409 | | |
| |||
398 | 417 | | |
399 | 418 | | |
400 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
401 | 435 | | |
402 | 436 | | |
403 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1184 | 1184 | | |
1185 | 1185 | | |
1186 | 1186 | | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1187 | 1196 | | |
1188 | 1197 | | |
1189 | 1198 | | |
| |||
1310 | 1319 | | |
1311 | 1320 | | |
1312 | 1321 | | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1313 | 1350 | | |
1314 | 1351 | | |
1315 | 1352 | | |
| |||
0 commit comments