MCPcopy Index your code
hub / github.com/github/copilot-sdk / goUntaggedUnionVariants

Function goUntaggedUnionVariants

scripts/codegen/go.ts:2692–2709  ·  view source on GitHub ↗
(typeName: string, schema: JSONSchema7, ctx: GoCodegenCtx)

Source from the content-addressed store, hash-verified

2690}
2691
2692function goUntaggedUnionVariants(typeName: string, schema: JSONSchema7, ctx: GoCodegenCtx): GoUntaggedUnionVariant[] | undefined {
2693 const members = goNonNullUnionMembers(schema);
2694 if (members.length === 0) return undefined;
2695
2696 const variants: GoUntaggedUnionVariant[] = [];
2697 const seenKinds = new Set<string>();
2698 const seenTypeNames = new Set<string>();
2699 for (const member of members) {
2700 const variant = goUntaggedUnionVariant(typeName, member, ctx);
2701 if (!variant) return undefined;
2702 if (seenKinds.has(variant.jsonKind) || seenTypeNames.has(variant.typeName)) return undefined;
2703 seenKinds.add(variant.jsonKind);
2704 seenTypeNames.add(variant.typeName);
2705 variants.push(variant);
2706 }
2707
2708 return variants;
2709}
2710
2711function emitGoUntaggedUnionInterface(typeName: string, schema: JSONSchema7, ctx: GoCodegenCtx, variants?: GoUntaggedUnionVariant[]): boolean {
2712 if (ctx.generatedNames.has(typeName)) return true;

Callers 2

planGoUnionFunction · 0.85

Calls 4

goNonNullUnionMembersFunction · 0.85
goUntaggedUnionVariantFunction · 0.85
addMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…