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

Function pushGoJSONSchemaMatchLines

scripts/codegen/go.ts:1315–1338  ·  view source on GitHub ↗
(
    lines: string[],
    schema: JSONSchema7,
    rawExpr: string,
    ctx: GoCodegenCtx,
    indent: string,
    varPrefix: string
)

Source from the content-addressed store, hash-verified

1313}
1314
1315function pushGoJSONSchemaMatchLines(
1316 lines: string[],
1317 schema: JSONSchema7,
1318 rawExpr: string,
1319 ctx: GoCodegenCtx,
1320 indent: string,
1321 varPrefix: string
1322): void {
1323 const objectSchema = goObjectSchemaForMatch(schema, ctx);
1324 if (objectSchema) {
1325 const objectVar = `${varPrefix}Object`;
1326 lines.push(`${indent}var ${objectVar} map[string]json.RawMessage`);
1327 lines.push(`${indent}if err := json.Unmarshal(${rawExpr}, &${objectVar}); err != nil {`);
1328 lines.push(`${indent}\treturn false`);
1329 lines.push(`${indent}}`);
1330 pushGoJSONObjectMatchLines(lines, objectSchema, objectVar, ctx, indent, varPrefix);
1331 return;
1332 }
1333
1334 const stringValues = goStringEnumValues(schema, ctx);
1335 if (stringValues) {
1336 pushGoJSONStringMatchLines(lines, rawExpr, stringValues, indent, varPrefix);
1337 }
1338}
1339
1340function goVariantMatchFuncName(variantTypeName: string): string {
1341 return goUnexportedFunctionName("matches", variantTypeName);

Callers 2

Calls 5

goObjectSchemaForMatchFunction · 0.85
goStringEnumValuesFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…