(logger: Logger, schema: Record<string, any>)
| 106 | |
| 107 | // Helper function to ensure we have a ZodObject |
| 108 | export function ensureZodObject(logger: Logger, schema: Record<string, any>): z.ZodObject<any> { |
| 109 | const zodSchema = jsonSchemaToZod(logger, schema) |
| 110 | |
| 111 | // If not already an object type, wrap it in an object |
| 112 | if (schema.type !== 'object') { |
| 113 | logger.warn('Schema is not an object type, wrapping in an object', { |
| 114 | type: schema.type, |
| 115 | }) |
| 116 | return z.object({ value: zodSchema }) |
| 117 | } |
| 118 | |
| 119 | // Safe cast since we know it's a ZodObject if type is 'object' |
| 120 | return zodSchema as z.ZodObject<any> |
| 121 | } |
| 122 | |
| 123 | export function normalizeUrl(url: string): string { |
| 124 | // Normalize the URL - only add https:// if needed |
no test coverage detected