Skip to content

Drop flat structs for complex union types.#376

Open
jmcarp wants to merge 1 commit intomainfrom
jmcarp/drop-flat-struct
Open

Drop flat structs for complex union types.#376
jmcarp wants to merge 1 commit intomainfrom
jmcarp/drop-flat-struct

Conversation

@jmcarp
Copy link
Contributor

@jmcarp jmcarp commented Feb 12, 2026

Earlier, we switched from any to interfaces with variant structs to represent tagged unions with a single value field. We left tagged unions with multiple value fields as flat structs at the time. This patch finishes the migration to interfaces for all tagged unions.

Downstream PRs:

@jmcarp jmcarp force-pushed the jmcarp/drop-flat-struct branch 2 times, most recently from 86f1467 to 0b723bf Compare February 12, 2026 16:27
Drop the flat struct pattern for representing tagged unions with multiple value
types, and instead use interfaces with variant types.

Note that we also fix pre-existing bugs related to marshalling and
unmarshalling interface wrapper types. We now correctly serialize nil
interfaces to `null`, rather than `{"type": ""}`, and correspondingly unmarshal
null oneOf fields to `nil`.
@jmcarp jmcarp force-pushed the jmcarp/drop-flat-struct branch from 0b723bf to ff67b95 Compare February 12, 2026 16:58
@jmcarp jmcarp marked this pull request as ready for review February 13, 2026 16:19
@jmcarp jmcarp requested a review from a team as a code owner February 13, 2026 16:19
Copy link
Member

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I focused mostly in the DESIGN.md and generated output, but changes LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants