import { z } from './deps.ts' interface ValidationError { field: string | number, message: string } function validateBody(schema: z.AnyZodObject, body: object) { try { schema.parse(body) } catch (err) { const error = err as z.ZodError; const errArr: Array = []; error.issues.forEach(x => { errArr.push({ field: x.path[0], message: x.message }) }) throw errArr } } export { validateBody }