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

Function goBooleanDiscriminatorValues

scripts/codegen/go.ts:2272–2291  ·  view source on GitHub ↗
(schema: JSONSchema7, ctx: GoCodegenCtx)

Source from the content-addressed store, hash-verified

2270}
2271
2272function goBooleanDiscriminatorValues(schema: JSONSchema7, ctx: GoCodegenCtx): boolean[] | undefined {
2273 const resolved = resolveSchema(schema, ctx.definitions) ?? schema;
2274 if (typeof resolved.const === "boolean") return [resolved.const];
2275 if (Array.isArray(resolved.enum) && resolved.enum.every((value) => typeof value === "boolean")) {
2276 return resolved.enum as boolean[];
2277 }
2278
2279 const unionMembers = goNonNullUnionMembers(resolved);
2280 if (unionMembers.length > 0) {
2281 const values: boolean[] = [];
2282 for (const member of unionMembers) {
2283 const memberValues = goBooleanDiscriminatorValues(member, ctx);
2284 if (!memberValues) return undefined;
2285 values.push(...memberValues);
2286 }
2287 return [...new Set(values)];
2288 }
2289
2290 return undefined;
2291}
2292
2293function mergeGoFlattenedPropertySchema(
2294 typeName: string,

Callers 1

goDiscriminatorValuesFunction · 0.85

Calls 3

resolveSchemaFunction · 0.85
goNonNullUnionMembersFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…