(config: unknown)
| 263 | * @returns Validation result with success status and optional error message |
| 264 | */ |
| 265 | export function validateConfig(config: unknown): { success: boolean; error?: string } { |
| 266 | try { |
| 267 | GlobalConfigSchema.parse(config); |
| 268 | return { success: true }; |
| 269 | } catch (error) { |
| 270 | if (error instanceof z.ZodError) { |
| 271 | const zodError = error as z.ZodError; |
| 272 | const messages = zodError.issues.map((e) => `${e.path.join('.')}: ${e.message}`); |
| 273 | return { success: false, error: messages.join('; ') }; |
| 274 | } |
| 275 | return { success: false, error: 'Unknown validation error' }; |
| 276 | } |
| 277 | } |
no outgoing calls
no test coverage detected