@fern-api/go-dynamic-snippets 1.49.5 → 1.49.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -27,6 +27,57 @@ declare class DynamicTypeInstantiationMapper {
27
27
  private convertLiteralToOptionalPrimitive;
28
28
  private convertDiscriminatedUnion;
29
29
  private getBaseFields;
30
+ /**
31
+ * Returns the wire values of the union base properties that the Go model generator drops as
32
+ * top-level struct fields when `dedupeUnionBaseProperties` is enabled — mirroring the model's
33
+ * `unionInheritedBasePropertyNames` so the snippet and the generated model dedupe an identical
34
+ * set.
35
+ *
36
+ * The decision has a language-agnostic core and a thin Go-specific widening, exactly as in the
37
+ * model:
38
+ * - Core: the IR marks (in `DiscriminatedUnionType.inheritedBaseProperties`, the dynamic-IR
39
+ * mirror of `UnionTypeDeclaration.inheritedBaseProperties`) the base properties every
40
+ * `samePropertiesAsObject` variant redeclares with a structurally-equal type. This is the
41
+ * shared source of truth, so the decision is not re-derived per language.
42
+ * - Go-render widening: Go additionally dedupes a base property that every variant redeclares
43
+ * with a Go-RENDER-equivalent type (e.g. `list`/`set` both render `[]T`, `optional`/`nullable`
44
+ * both `*T`) even though the IR's conservative structural equality left it unmarked; the
45
+ * delegating getter still compiles, so the top-level field is safe to drop.
46
+ *
47
+ * Literal base properties are always kept at the union root (they render as `<Name>()` methods,
48
+ * not delegatable fields), matching the model. Base properties that a variant does not carry, or
49
+ * that a variant redeclares with a different Go getter type, keep their top-level field and must
50
+ * still be set at the union root, so they are excluded here.
51
+ *
52
+ * To stay in lockstep with the model, base<->variant properties are matched by Go field name (not
53
+ * wire value) via {@link getObjectExportedProperties}, and compared through
54
+ * {@link getGoGetterTypeString} — the single comparison primitive that renders a getter's Go type
55
+ * including the `getters-pass-by-value` `*`-stripping the model applies. Both the structural-core
56
+ * and the widening path route through it, so the two generators cannot drift.
57
+ */
58
+ private getDedupedBasePropertyWireValues;
59
+ /**
60
+ * Collects the properties an object exports, keyed by Go field name, following its `extends` chain
61
+ * (matching the model's `objectExportedProperties`). Extended properties are collected first so a
62
+ * property declared directly on the object overrides one inherited via `extends`, exactly as the
63
+ * model does. Empty for anything that does not resolve to an object.
64
+ */
65
+ private getObjectExportedProperties;
66
+ /**
67
+ * Renders the Go type a getter for `typeReference` would return, so two references can be compared
68
+ * for Go-getter-type equality. This is the single comparison primitive the dedupe decision uses,
69
+ * mirroring the model's `processTypeFieldForOptional`:
70
+ * - the type mapper collapses Go-render-equivalent shapes (`list`/`set` -> `[]T`,
71
+ * `optional`/`nullable` -> `*T`), and
72
+ * - when `getters-pass-by-value` is enabled the model returns the DEREFERENCED type for an
73
+ * optional/nullable field, so we render the unwrapped type here to match. Without this the
74
+ * snippet would keep a base field the model dropped under that config, re-introducing drift.
75
+ *
76
+ * `packageName`/`importPath` are arbitrary: the result is only ever compared against another
77
+ * string produced by this same method, so any consistent values work, and rendering against a
78
+ * throwaway file means it never registers imports on real output.
79
+ */
80
+ private getGoGetterTypeString;
30
81
  private convertObject;
31
82
  private convertEnum;
32
83
  private getEnumValueName;
package/dist/index.d.ts CHANGED
@@ -27,6 +27,57 @@ declare class DynamicTypeInstantiationMapper {
27
27
  private convertLiteralToOptionalPrimitive;
28
28
  private convertDiscriminatedUnion;
29
29
  private getBaseFields;
30
+ /**
31
+ * Returns the wire values of the union base properties that the Go model generator drops as
32
+ * top-level struct fields when `dedupeUnionBaseProperties` is enabled — mirroring the model's
33
+ * `unionInheritedBasePropertyNames` so the snippet and the generated model dedupe an identical
34
+ * set.
35
+ *
36
+ * The decision has a language-agnostic core and a thin Go-specific widening, exactly as in the
37
+ * model:
38
+ * - Core: the IR marks (in `DiscriminatedUnionType.inheritedBaseProperties`, the dynamic-IR
39
+ * mirror of `UnionTypeDeclaration.inheritedBaseProperties`) the base properties every
40
+ * `samePropertiesAsObject` variant redeclares with a structurally-equal type. This is the
41
+ * shared source of truth, so the decision is not re-derived per language.
42
+ * - Go-render widening: Go additionally dedupes a base property that every variant redeclares
43
+ * with a Go-RENDER-equivalent type (e.g. `list`/`set` both render `[]T`, `optional`/`nullable`
44
+ * both `*T`) even though the IR's conservative structural equality left it unmarked; the
45
+ * delegating getter still compiles, so the top-level field is safe to drop.
46
+ *
47
+ * Literal base properties are always kept at the union root (they render as `<Name>()` methods,
48
+ * not delegatable fields), matching the model. Base properties that a variant does not carry, or
49
+ * that a variant redeclares with a different Go getter type, keep their top-level field and must
50
+ * still be set at the union root, so they are excluded here.
51
+ *
52
+ * To stay in lockstep with the model, base<->variant properties are matched by Go field name (not
53
+ * wire value) via {@link getObjectExportedProperties}, and compared through
54
+ * {@link getGoGetterTypeString} — the single comparison primitive that renders a getter's Go type
55
+ * including the `getters-pass-by-value` `*`-stripping the model applies. Both the structural-core
56
+ * and the widening path route through it, so the two generators cannot drift.
57
+ */
58
+ private getDedupedBasePropertyWireValues;
59
+ /**
60
+ * Collects the properties an object exports, keyed by Go field name, following its `extends` chain
61
+ * (matching the model's `objectExportedProperties`). Extended properties are collected first so a
62
+ * property declared directly on the object overrides one inherited via `extends`, exactly as the
63
+ * model does. Empty for anything that does not resolve to an object.
64
+ */
65
+ private getObjectExportedProperties;
66
+ /**
67
+ * Renders the Go type a getter for `typeReference` would return, so two references can be compared
68
+ * for Go-getter-type equality. This is the single comparison primitive the dedupe decision uses,
69
+ * mirroring the model's `processTypeFieldForOptional`:
70
+ * - the type mapper collapses Go-render-equivalent shapes (`list`/`set` -> `[]T`,
71
+ * `optional`/`nullable` -> `*T`), and
72
+ * - when `getters-pass-by-value` is enabled the model returns the DEREFERENCED type for an
73
+ * optional/nullable field, so we render the unwrapped type here to match. Without this the
74
+ * snippet would keep a base field the model dropped under that config, re-introducing drift.
75
+ *
76
+ * `packageName`/`importPath` are arbitrary: the result is only ever compared against another
77
+ * string produced by this same method, so any consistent values work, and rendering against a
78
+ * throwaway file means it never registers imports on real output.
79
+ */
80
+ private getGoGetterTypeString;
30
81
  private convertObject;
31
82
  private convertEnum;
32
83
  private getEnumValueName;