Commit 7519bf4
committed
fix(jvm): ADR-0036 Wave 2 — api-contract harness + Kotlin controller emit Instant for createdAt
`Author.createdAt` is a bare `field.timestamp`, which under ADR-0036 Wave 2
generates as `java.time.Instant` (instant/tz-aware default). Align the JVM
api-contract test harnesses (Java + Kotlin) — and close one genuine Wave-2
generator gap — so the generated-controller lane compiles and round-trips.
createdAt wire form is now an absolute UTC instant (`yyyy-MM-ddTHH:mm:ssZ`).
Offset-less corpus seed/scenario strings are interpreted as UTC (append `Z`),
mirroring the C# lane.
Java:
- generated/GeneratedAuthorControllerHarness: DTO ctor reflection signature
`LocalDateTime.class` → `Instant.class`; build createdAt via `Instant.parse`
(UTC-interpreting); register a UTC Instant Jackson deserializer so offset-less
request bodies deserialize into the generated DTO's `Instant` field.
- generated/InMemoryAuthorRepositorySource: `AuthorDto.createdAt` is `Instant`;
filter comparison parses operands as UTC instants; refreshed stale comment.
- AuthorApiServer (reference lane): `createdAt` column → `timestamp with time
zone`; read/write/filter via UTC `OffsetDateTime`/`Instant`; emit `...Z` wire.
Kotlin:
- generated/GeneratedAuthorControllerHarness: register a UTC Instant Jackson
deserializer for the generated `Author.createdAt: Instant`.
- AuthorApiServer (reference lane): `AuthorTable.createdAt` → Exposed
`timestamp()` (Instant); parse/format/filter via UTC instants; emit `...Z`.
- KotlinSpringControllerGenerator (generator gap): a default `field.timestamp`
column is `Column<Instant>`, but the controller imported only `LocalDateTime`
and the timestamp filter-coercer produced a `LocalDateTime` — a missing import
+ a ClassCast at the `p.value as Instant` dispatch cast. Now import
`java.time.Instant` when an Instant-typed timestamp column is in the filter
surface, and emit an Instant-producing (UTC-interpreting) coercer for it.
Instant-free entities stay byte-identical (snapshot golden unchanged).
Verified against Testcontainers Postgres (Docker available): all Java + Kotlin
api-contract integration tests green (53/53 each, incl. generated/TPH/jsonb/m2m
lanes); codegen-kotlin 255/255 (snapshot golden byte-identical).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GF9xLEQZaPus5Y6opk398n1 parent c65bf22 commit 7519bf4
6 files changed
Lines changed: 164 additions & 53 deletions
File tree
- server/java
- codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin
- integration-tests-kotlin/src/test/kotlin/com/metaobjects/integration/kotlin/api
- generated
- integration-tests/src/test/java/com/metaobjects/integration/api
- generated
Lines changed: 34 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
459 | 465 | | |
460 | 466 | | |
461 | 467 | | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
462 | 474 | | |
463 | 475 | | |
464 | 476 | | |
| |||
743 | 755 | | |
744 | 756 | | |
745 | 757 | | |
746 | | - | |
747 | | - | |
748 | | - | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
749 | 772 | | |
750 | 773 | | |
751 | | - | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
752 | 782 | | |
753 | 783 | | |
754 | 784 | | |
| |||
Lines changed: 24 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
235 | 236 | | |
236 | 237 | | |
237 | 238 | | |
238 | | - | |
239 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
| |||
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
289 | | - | |
290 | | - | |
291 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
292 | 296 | | |
293 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
294 | 301 | | |
295 | 302 | | |
296 | 303 | | |
| |||
369 | 376 | | |
370 | 377 | | |
371 | 378 | | |
372 | | - | |
| 379 | + | |
373 | 380 | | |
374 | 381 | | |
375 | 382 | | |
| |||
436 | 443 | | |
437 | 444 | | |
438 | 445 | | |
439 | | - | |
| 446 | + | |
440 | 447 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
448 | 455 | | |
449 | 456 | | |
450 | 457 | | |
| |||
479 | 486 | | |
480 | 487 | | |
481 | 488 | | |
482 | | - | |
| 489 | + | |
483 | 490 | | |
484 | 491 | | |
485 | 492 | | |
| |||
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
76 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
80 | 102 | | |
81 | 103 | | |
82 | 104 | | |
| |||
Lines changed: 31 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
87 | | - | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | | - | |
| 130 | + | |
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| |||
324 | 328 | | |
325 | 329 | | |
326 | 330 | | |
327 | | - | |
| 331 | + | |
328 | 332 | | |
329 | 333 | | |
330 | 334 | | |
| |||
412 | 416 | | |
413 | 417 | | |
414 | 418 | | |
415 | | - | |
| 419 | + | |
416 | 420 | | |
417 | 421 | | |
418 | 422 | | |
| |||
443 | 447 | | |
444 | 448 | | |
445 | 449 | | |
446 | | - | |
| 450 | + | |
447 | 451 | | |
448 | 452 | | |
449 | 453 | | |
| |||
497 | 501 | | |
498 | 502 | | |
499 | 503 | | |
500 | | - | |
501 | | - | |
502 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
503 | 507 | | |
504 | 508 | | |
505 | 509 | | |
| |||
536 | 540 | | |
537 | 541 | | |
538 | 542 | | |
539 | | - | |
540 | | - | |
541 | | - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
542 | 559 | | |
543 | 560 | | |
544 | 561 | | |
| |||
0 commit comments