Files
playzer/apps/backend/src/lib/http/zod-issues.ts
2026-05-06 17:03:42 -03:00

17 lines
368 B
TypeScript

type IssueLike = {
path: PropertyKey[];
message: string;
};
export function zodIssuesToRecord(issues: IssueLike[]): Record<string, string[]> {
const out: Record<string, string[]> = {};
for (const issue of issues) {
const key = issue.path.length ? issue.path.join('.') : 'root';
out[key] ??= [];
out[key].push(issue.message);
}
return out;
}