Problem
Kotlin sealed/permits doesn't fit Java-8 generated output, and unions need forward-compat.
Proposed change
Emit unions as a private-constructor class with one nullable field per variant, an accept(Visitor<T>) that dispatches on the first non-null arm else visitor.unknown(raw) (default unknown throws), and a retained raw node on every parsed variant. Emit the deserializer against the Serde SPI, not Jackson.
Prior art: openai-java's union types (e.g. ChatCompletionContentPart.kt) — Apache-2.0.
Acceptance
Dependencies
Priority: high · Effort: medium
Problem
Kotlin
sealed/permitsdoesn't fit Java-8 generated output, and unions need forward-compat.Proposed change
Emit unions as a private-constructor class with one nullable field per variant, an
accept(Visitor<T>)that dispatches on the first non-null arm elsevisitor.unknown(raw)(defaultunknownthrows), and a retained raw node on every parsed variant. Emit the deserializer against theSerdeSPI, not Jackson.Prior art: openai-java's union types (e.g.
ChatCompletionContentPart.kt) — Apache-2.0.Acceptance
Dependencies
Priority: high · Effort: medium