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

Function getNullableInner

scripts/codegen/utils.ts:420–426  ·  view source on GitHub ↗
(schema: JSONSchema7)

Source from the content-addressed store, hash-verified

418 * Returns undefined if the schema is not a nullable wrapper.
419 */
420export function getNullableInner(schema: JSONSchema7): JSONSchema7 | undefined {
421 if (!schema.anyOf || !Array.isArray(schema.anyOf) || schema.anyOf.length !== 2) return undefined;
422 const [a, b] = schema.anyOf;
423 if (isNullLike(a) && !isNullLike(b)) return b as JSONSchema7;
424 if (isNullLike(b) && !isNullLike(a)) return a as JSONSchema7;
425 return undefined;
426}
427
428function isNullLike(s: unknown): boolean {
429 if (!s || typeof s !== "object") return false;

Callers 15

isNullableParamsSchemaFunction · 0.85
generateApiTypesCodeFunction · 0.85
methodUsesInternalSchemaFunction · 0.85
generateRpcCodeFunction · 0.85
tsNullableResultTypeNameFunction · 0.85
generateRpcFunction · 0.85
schemaTypeToCSharpFunction · 0.85
isDurationPropertyFunction · 0.85
resolvedResultTypeNameFunction · 0.85
resolveRpcTypeFunction · 0.85
emitSessionMethodFunction · 0.85

Calls 1

isNullLikeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…