Skip to content

Commit d3ca252

Browse files
authored
Sync alphalib 2025 05 15 (#232)
1 parent 5ab950d commit d3ca252

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/alphalib/zodParseWithContext.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ export function zodParseWithContext<T extends z.ZodType>(
5656
(firstError as z.ZodInvalidUnionIssue).unionErrors.length > 0
5757
) {
5858
const humanReadable =
59-
"Validation failed: Input object is empty or missing key fields required to determine its type, " +
60-
"and does not match any variant of the expected schema. Please provide a valid object."
59+
'Validation failed: Input object is empty or missing key fields required to determine its type, ' +
60+
'and does not match any variant of the expected schema. Please provide a valid object.'
6161
return {
6262
success: false,
6363
// For this specific summarized error, we might not need to map all detailed ZodIssueWithContext
6464
// or we can provide a simplified single error entry reflecting this summary.
6565
// For now, let's return the original errors but with the new top-level humanReadable.
66-
errors: zodRes.error.errors.map(e => ({...e, parentObj: obj, humanReadable: e.message})),
66+
errors: zodRes.error.errors.map((e) => ({
67+
...e,
68+
parentObj: obj,
69+
humanReadable: e.message,
70+
})),
6771
humanReadable,
6872
}
6973
}

0 commit comments

Comments
 (0)