* Get description from a Zod type if available.
(t: z.ZodType)
| 115 | * Get description from a Zod type if available. |
| 116 | */ |
| 117 | function getDescription(t: z.ZodType): string | undefined { |
| 118 | // Zod 4 uses _zod.def.description |
| 119 | const def = (t as { _zod?: { def?: { description?: string } } })._zod?.def; |
| 120 | if (def?.description) return def.description; |
| 121 | |
| 122 | // Zod 3 fallback |
| 123 | const legacyDef = (t as { _def?: { description?: string } })._def; |
| 124 | return legacyDef?.description; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Get enum values from a Zod enum type. |