MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / isOptional

Function isOptional

src/cli/schema-to-yargs.ts:95–112  ·  view source on GitHub ↗

* Check if a Zod type is optional/nullable/has default.

(t: z.ZodType)

Source from the content-addressed store, hash-verified

93 * Check if a Zod type is optional/nullable/has default.
94 */
95function isOptional(t: z.ZodType): boolean {
96 const typeName = getZodTypeName(t);
97
98 if (
99 typeName === 'optional' ||
100 typeName === 'nullable' ||
101 typeName === 'default' ||
102 typeName === 'prefault'
103 ) {
104 return true;
105 }
106
107 // Check wrapper types recursively
108 const inner = getInnerType(t);
109 if (inner) return isOptional(inner);
110
111 return false;
112}
113
114/**
115 * Get description from a Zod type if available.

Callers 1

zodToYargsOptionFunction · 0.85

Calls 2

getZodTypeNameFunction · 0.85
getInnerTypeFunction · 0.85

Tested by

no test coverage detected