import type { ZodError } from "zod/v4"; import { ValidationErrorCollection, type ValidationErrorDetail } from "../errors"; export function translateZodValidationError( message: string, zodError: ZodError, errorValue?: unknown ) { const errors: ValidationErrorDetail[] = []; for (const issue of zodError.issues) { errors.push({ message: `${message}: ${issue.message}`, path: issue.path ? issue.path.join(".") : undefined, value: errorValue ?? issue.input, }); } return new ValidationErrorCollection(message, errors); }