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

Function collectLocalDefinitionRefNames

scripts/codegen/utils.ts:1599–1619  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

1597}
1598
1599function collectLocalDefinitionRefNames(value: unknown): Set<string> {
1600 const refs = new Set<string>();
1601
1602 const visit = (node: unknown): void => {
1603 if (!node || typeof node !== "object") return;
1604 if (Array.isArray(node)) {
1605 for (const item of node) visit(item);
1606 return;
1607 }
1608
1609 const record = node as Record<string, unknown>;
1610 if (typeof record.$ref === "string") {
1611 const localRef = parseLocalDefinitionRef(record.$ref);
1612 if (localRef) refs.add(localRef);
1613 }
1614 for (const child of Object.values(record)) visit(child);
1615 };
1616
1617 visit(value);
1618 return refs;
1619}
1620
1621function parseLocalDefinitionRef(ref: string): string | undefined {
1622 const match = ref.match(/^#\/(?:definitions|\$defs)\/(.+)$/);

Callers 1

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…