Skip to content

[pull] main from fern-api:main#802

Merged
pull[bot] merged 2 commits into
code:mainfrom
fern-api:main
Jun 18, 2026
Merged

[pull] main from fern-api:main#802
pull[bot] merged 2 commits into
code:mainfrom
fern-api:main

Conversation

@pull

@pull pull Bot commented Jun 18, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

patrickthornton and others added 2 commits June 18, 2026 01:06
…#16554)

* feat(go): add dedupeUnionBaseProperties flag to drop duplicated union base properties

When a discriminated union has base properties that every variant already
carries (e.g. lifted from a shared parent by infer-discriminated-union-base-properties),
the new opt-in dedupeUnionBaseProperties config (default false) suppresses the
duplicate top-level fields and exposes them via discriminant-switching getters
that read from the active variant.

* fix(go): keep literal base properties out of union dedup

A literal base property carried by every variant must not be suppressed:
the union and each variant expose literals via a `<Name>()` getter (no `Get`
prefix), so a delegating `Get<Name>()` would call a non-existent variant
method and fail to compile. Exclude literals from the suppression set so they
stay on the normal literal path.

* fix(go): only dedupe union base properties when variant getters match

Suppression previously matched base↔variant properties by name only and
assumed each variant exposed a Get<Name>() returning the base property's type.
A same-named variant property with a different type, or a literal (whose getter
is <Name>() with no Get prefix), produced a delegating getter that did not
compile. Now suppress a base property only when every variant declares a
non-literal property of the same name whose getter type matches the base
property's getter type; otherwise keep the top-level field. Type comparison
runs against a throwaway scope so a variant's (unused) type never leaks in as
an import. Also pass the precomputed set into getTypeFieldsForUnion instead of
recomputing it.
@pull pull Bot locked and limited conversation to collaborators Jun 18, 2026
@pull pull Bot added the ⤵️ pull label Jun 18, 2026
@pull pull Bot merged commit e3f6413 into code:main Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant