Commit f5bab8c
fix(integration-tests): Java TPH harness coerces the enum-typed @Discriminator
release-gate (java) was failing (uncovered once the Maven dep-resolution fix let
it actually run): TphGeneratedApiContractConformanceTest's generated sources failed
to compile with "String cannot be converted to AuthDto.AuthType". Proven pre-existing
(reproduces with the pre-FR-019 generator) — the TPH api-contract fixture's `type`
discriminator is a field.enum, so the generated AuthDto types it as the AuthType enum
(the cross-port typed-enum contract), but the Java test scaffolding still assumed a
String-typed discriminator. Kotlin's release-gate passed because its harness seeds via
HTTP POST (discriminator from the URL) and never constructs a DTO with the raw String.
Bring the Java harness/scaffolding in line with the enum-typed discriminator:
- GeneratedTphControllerHarness: resolve the generated nested AuthType reflectively,
bind the ctor with it, and coerce the seed's String `type` via Enum.valueOf.
- InMemoryAuthRepositorySource: coerce the URL discriminator with AuthType.valueOf
on create, and compare via a.type().name() (String-vs-enum equality was silently
always-false, which would have broken per-subtype scoping).
TphGeneratedApiContractConformanceTest now 5/0 locally (in-process MockMvc, no docker).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c2800bd commit f5bab8c
2 files changed
Lines changed: 18 additions & 8 deletions
File tree
- server/java/integration-tests/src/test/java/com/metaobjects/integration/api/tph/generated
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
112 | 116 | | |
113 | | - | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
165 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
| |||
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
102 | 105 | | |
103 | | - | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| |||
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
113 | | - | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
129 | | - | |
| 132 | + | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| |||
0 commit comments