Commit da00178
feat(codegen): FR-017 TPH — FR-009 filtering on the polymorphic + per-subtype lists (Java + Kotlin)
Follow-up to the TPH api-contract lanes (review finding): the reference Python/TS TPH routers wire
the FR-009 filter pipeline into both the polymorphic and per-subtype list handlers, but the Java +
Kotlin generators emitted sort-only TPH controllers — a real cross-port capability gap. Both now
filter, matching the reference (and retiring the previously-dead Java AuthFilterAllowlist).
- Allowlist (Java + Kotlin) unions the base + subtype-only filterable columns for a TPH base, but
EXCLUDES the discriminator (addressable via the per-subtype route segment) and decimal columns
(decimal wire formatting differs per port → no portable operand; also dodges the generic
pipeline's enum/BigDecimal coercion limits). Java + Kotlin filter the same surface.
- Java: TPH repository gains list/count/listByType filter params; the controller parses
filter[field][op]=v against the union allowlist and threads predicates (polymorphic + per-subtype).
- Kotlin: the self-contained controller emits the FR-009 parse+Op-dispatch pipeline over the union
columns and AND's it with the per-subtype discriminator scope.
Also from the review:
- Java union DTO drops now-inert bean-validation (the controller omits @Valid) → an all-nullable
partial-PATCH-friendly wire body, matching the Kotlin union data class.
- Kotlin emitTph fails loud at generation if a @discriminatorValue is not a valid Kotlin
enum-constant identifier (the controller references it as <Enum>.<Value>).
Tested by new local filter smokes (the shared corpus is sort-only): Java TPH 5/0, Kotlin TPH 5/0.
No regression: codegen-spring 144/0, codegen-kotlin green, Java + Kotlin vanilla Author/m2m lanes green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 09ae8d5 commit da00178
9 files changed
Lines changed: 270 additions & 32 deletions
File tree
- server/java
- codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin
- codegen-spring/src/main/java/com/metaobjects/generator/spring
- integration-tests-kotlin/src/test/kotlin/com/metaobjects/integration/kotlin/api/tph
- integration-tests/src/test/java/com/metaobjects/integration/api
- tph/generated
Lines changed: 25 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
71 | 82 | | |
72 | 83 | | |
73 | 84 | | |
| |||
134 | 145 | | |
135 | 146 | | |
136 | 147 | | |
137 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
138 | 157 | | |
139 | | - | |
| 158 | + | |
140 | 159 | | |
141 | 160 | | |
142 | 161 | | |
143 | 162 | | |
144 | | - | |
| 163 | + | |
145 | 164 | | |
146 | 165 | | |
147 | 166 | | |
| |||
Lines changed: 46 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
395 | 405 | | |
396 | 406 | | |
397 | 407 | | |
398 | 408 | | |
399 | 409 | | |
400 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
401 | 419 | | |
402 | 420 | | |
403 | 421 | | |
404 | 422 | | |
405 | 423 | | |
406 | 424 | | |
| 425 | + | |
407 | 426 | | |
408 | 427 | | |
409 | 428 | | |
| |||
423 | 442 | | |
424 | 443 | | |
425 | 444 | | |
426 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
427 | 454 | | |
428 | 455 | | |
429 | 456 | | |
| |||
442 | 469 | | |
443 | 470 | | |
444 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
445 | 476 | | |
446 | 477 | | |
447 | 478 | | |
| |||
460 | 491 | | |
461 | 492 | | |
462 | 493 | | |
| 494 | + | |
463 | 495 | | |
464 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
465 | 500 | | |
466 | 501 | | |
467 | 502 | | |
| |||
489 | 524 | | |
490 | 525 | | |
491 | 526 | | |
492 | | - | |
| 527 | + | |
493 | 528 | | |
494 | 529 | | |
495 | 530 | | |
496 | 531 | | |
497 | 532 | | |
| 533 | + | |
498 | 534 | | |
499 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
500 | 542 | | |
501 | 543 | | |
502 | 544 | | |
| |||
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
354 | 355 | | |
355 | 356 | | |
356 | 357 | | |
| |||
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
376 | 381 | | |
377 | 382 | | |
378 | 383 | | |
| |||
402 | 407 | | |
403 | 408 | | |
404 | 409 | | |
405 | | - | |
| 410 | + | |
| 411 | + | |
406 | 412 | | |
407 | 413 | | |
408 | 414 | | |
409 | 415 | | |
410 | 416 | | |
411 | 417 | | |
412 | 418 | | |
413 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
414 | 424 | | |
415 | | - | |
| 425 | + | |
416 | 426 | | |
417 | 427 | | |
418 | 428 | | |
| |||
438 | 448 | | |
439 | 449 | | |
440 | 450 | | |
441 | | - | |
| 451 | + | |
| 452 | + | |
442 | 453 | | |
443 | 454 | | |
444 | 455 | | |
445 | 456 | | |
446 | 457 | | |
447 | 458 | | |
448 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
449 | 463 | | |
450 | | - | |
| 464 | + | |
451 | 465 | | |
452 | 466 | | |
453 | 467 | | |
| |||
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | 110 | | |
113 | 111 | | |
114 | 112 | | |
115 | | - | |
116 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
0 commit comments