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

Function goSchemaJSONKind

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

Source from the content-addressed store, hash-verified

2605}
2606
2607function goSchemaJSONKind(schema: JSONSchema7, ctx: GoCodegenCtx): string | undefined {
2608 const resolved = resolveGoUnionMember(schema, ctx.definitions);
2609 if (resolved.const !== undefined) {
2610 return goSchemaJSONKind(schemaForConstValue(resolved.const), ctx);
2611 }
2612
2613 if (Array.isArray(resolved.type)) {
2614 const nonNullTypes = resolved.type.filter((type) => type !== "null");
2615 if (nonNullTypes.length === 1) {
2616 return goSchemaJSONKind({ ...resolved, type: nonNullTypes[0] } as JSONSchema7, ctx);
2617 }
2618 return undefined;
2619 }
2620
2621 if (goObjectUnionMemberSchema(schema, ctx)) return "object";
2622
2623 switch (resolved.type) {
2624 case "array": return "array";
2625 case "boolean": return "boolean";
2626 case "integer":
2627 case "number": return "number";
2628 case "object": return "object";
2629 case "string": return "string";
2630 default: return undefined;
2631 }
2632}
2633
2634function goUntaggedUnionVariant(typeName: string, member: JSONSchema7, ctx: GoCodegenCtx): GoUntaggedUnionVariant | undefined {
2635 const jsonKind = goSchemaJSONKind(member, ctx);

Callers 1

goUntaggedUnionVariantFunction · 0.85

Calls 3

resolveGoUnionMemberFunction · 0.85
schemaForConstValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…