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

Function goStringEnumValues

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

Source from the content-addressed store, hash-verified

2229}
2230
2231function goStringEnumValues(schema: JSONSchema7, ctx: GoCodegenCtx): string[] | undefined {
2232 const resolved = resolveSchema(schema, ctx.definitions) ?? schema;
2233 if (typeof resolved.const === "string") return [resolved.const];
2234 if (isStringEnumDefinition(resolved)) return resolved.enum;
2235
2236 const unionMembers = goNonNullUnionMembers(resolved);
2237 if (unionMembers.length > 0) {
2238 const values: string[] = [];
2239 for (const member of unionMembers) {
2240 const memberValues = goStringEnumValues(member, ctx);
2241 if (!memberValues) return undefined;
2242 values.push(...memberValues);
2243 }
2244 return [...new Set(values)];
2245 }
2246
2247 return undefined;
2248}
2249
2250function goBooleanValues(schema: JSONSchema7, ctx: GoCodegenCtx): boolean[] | undefined {
2251 const resolved = resolveSchema(schema, ctx.definitions) ?? schema;

Callers 5

goDiscriminatorValuesFunction · 0.85
goSchemaNeedsJSONMatchFunction · 0.85

Calls 4

resolveSchemaFunction · 0.85
isStringEnumDefinitionFunction · 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…