Java: Generate typed catalogue candidates - #2532
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Generated polymorphic candidates can serialize duplicate discriminator properties.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
java/scripts/codegen/java.ts — Returning the promoted union as a polymorphic type also changes serialization:… |
What changed in this PR
Generates typed Java catalogue candidate hierarchies from nested discriminated unions.
Changes:
- Promotes nested catalogue unions into generated Java types.
- Adds candidate/source classes and typed candidate lists.
- Adds generator and Jackson coverage.
| File | Description |
|---|---|
CatalogCandidateJacksonTest.java |
Tests candidate deserialization and round-tripping. |
CatalogSearchSucceeded.java |
Uses typed candidates. |
CatalogMcpServerInstallability.java |
Adds installability enum. |
CatalogMcpServerCandidateProvenance.java |
Adds MCP provenance type. |
CatalogMcpServerCandidate.java |
Adds MCP candidate variant. |
CatalogCandidateSourceUrl.java |
Adds URL source variant. |
CatalogCandidateSourceEmbedded.java |
Adds embedded source variant. |
CatalogCandidateSource.java |
Adds source union base. |
CatalogCandidate.java |
Adds candidate union base. |
CatalogAiSkillCandidateProvenance.java |
Adds skill provenance type. |
CatalogAiSkillCandidate.java |
Adds AI skill candidate variant. |
java/scripts/codegen/package.json |
Adds generator test command. |
java/scripts/codegen/java.ts |
Implements nested-union promotion. |
java/scripts/codegen/java.test.ts |
Tests promoted type resolution. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
|
@SteveSandersonMS CI is green. This is the agreed Java-only scope: typed catalogue candidate and source generation, with non-Catalogue and non-Java output unchanged. Would you mind taking a look? |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SteveSandersonMS
left a comment
There was a problem hiding this comment.
I verified this is a minimal Java-only codegen parity fix: other SDK RPC output is unchanged, non-catalog Java output regenerates byte-identically, and the catalog unions now deserialize and serialize with the existing discriminators exactly once. I also resolved the package.json conflict against main while retaining both schema-fetch and codegen tests.
Cross-SDK Consistency Review — PR #2532Scope: Java-only change (codegen script + generated types), fixing
The root cause was the Java codegen's handling of nested discriminated unions inside array items — it wasn't promoting Assessment: ✅ No consistency issue — this brings Java into parity with the other five SDKs rather than creating a gap. It's a bugfix confined to the Java codegen pipeline and generated output; no behavior or API changed in TS/Python/Go/.NET/Rust, so no cross-language follow-up is needed.
|

Summary
List<Object>Validation
npm --prefix java/scripts/codegen testcd java && mvn verifyRelated to #2106