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

Function goCollectRequiredJSONMatchTerms

scripts/codegen/go.ts:1396–1425  ·  view source on GitHub ↗
(
    schema: JSONSchema7,
    ctx: GoCodegenCtx,
    discriminatorProp: string,
    path: string[] = []
)

Source from the content-addressed store, hash-verified

1394}
1395
1396function goCollectRequiredJSONMatchTerms(
1397 schema: JSONSchema7,
1398 ctx: GoCodegenCtx,
1399 discriminatorProp: string,
1400 path: string[] = []
1401): GoJSONMatchTerm[] {
1402 const objectSchema = goObjectSchemaForMatch(schema, ctx);
1403 if (!objectSchema) return [];
1404
1405 const properties = objectSchema.properties || {};
1406 const terms: GoJSONMatchTerm[] = [];
1407 for (const propName of [...new Set(objectSchema.required || [])].sort()) {
1408 if (path.length === 0 && propName === discriminatorProp) continue;
1409 const propSchema = properties[propName];
1410 if (typeof propSchema !== "object") continue;
1411
1412 const propPath = [...path, propName];
1413 const prop = propSchema as JSONSchema7;
1414 terms.push({ kind: "propertyExists", path: propPath });
1415
1416 const stringValues = goStringEnumValues(prop, ctx);
1417 if (stringValues) {
1418 terms.push({ kind: "stringValue", path: propPath, values: [...new Set(stringValues)].sort() });
1419 }
1420
1421 terms.push(...goCollectRequiredJSONMatchTerms(prop, ctx, discriminatorProp, propPath));
1422 }
1423
1424 return dedupeGoJSONMatchTerms(terms);
1425}
1426
1427function removeRedundantGoJSONExistsTerms(terms: GoJSONMatchTerm[]): GoJSONMatchTerm[] {
1428 const stringPaths = new Set(terms

Callers 1

Calls 4

goObjectSchemaForMatchFunction · 0.85
goStringEnumValuesFunction · 0.85
dedupeGoJSONMatchTermsFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…