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

Function walkApiNode

scripts/codegen/utils.ts:522–540  ·  view source on GitHub ↗
(node: Record<string, unknown> | undefined)

Source from the content-addressed store, hash-verified

520 */
521export function fixNullableRequiredRefsInApiSchema(schema: ApiSchema): ApiSchema {
522 function walkApiNode(node: Record<string, unknown> | undefined): Record<string, unknown> | undefined {
523 if (!node) return undefined;
524 const result: Record<string, unknown> = {};
525 for (const [key, value] of Object.entries(node)) {
526 if (isRpcMethod(value)) {
527 const method = value as RpcMethod;
528 result[key] = {
529 ...method,
530 params: method.params ? normalizeNullableRequiredRefs(method.params) : method.params,
531 result: method.result ? normalizeNullableRequiredRefs(method.result) : method.result,
532 };
533 } else if (typeof value === "object" && value !== null) {
534 result[key] = walkApiNode(value as Record<string, unknown>);
535 } else {
536 result[key] = value;
537 }
538 }
539 return result;
540 }
541
542 function normalizeDefs(defs: Record<string, JSONSchema7Definition> | undefined): Record<string, JSONSchema7Definition> | undefined {
543 if (!defs) return undefined;

Callers 1

Calls 2

isRpcMethodFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…