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

Function isParamsOptional

scripts/codegen/typescript.ts:431–441  ·  view source on GitHub ↗

True when the raw params schema uses `anyOf: [{ not: {} }, …]` — Zod's pattern for `.optional()`.

(method: RpcMethod)

Source from the content-addressed store, hash-verified

429
430/** True when the raw params schema uses `anyOf: [{ not: {} }, …]` — Zod's pattern for `.optional()`. */
431function isParamsOptional(method: RpcMethod): boolean {
432 const schema = method.params;
433 if (!schema?.anyOf) return false;
434 return schema.anyOf.some(
435 (item) =>
436 typeof item === "object" &&
437 (item as JSONSchema7).not !== undefined &&
438 typeof (item as JSONSchema7).not === "object" &&
439 Object.keys((item as JSONSchema7).not as object).length === 0
440 );
441}
442
443function resultTypeName(method: RpcMethod): string {
444 const schema = getMethodResultSchema(method);

Callers 1

emitGroupFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…