From a28212b11cd2063e33d5e044469ae0f79d15b2fd Mon Sep 17 00:00:00 2001 From: Alex Liu Date: Sat, 9 Sep 2023 18:10:17 +0800 Subject: [PATCH 1/2] fix(resolvers): ensure correct async validation for zod --- packages/resolvers/zod/src/zod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/resolvers/zod/src/zod.ts b/packages/resolvers/zod/src/zod.ts index 51d6b8f..fe4a912 100644 --- a/packages/resolvers/zod/src/zod.ts +++ b/packages/resolvers/zod/src/zod.ts @@ -28,7 +28,7 @@ const parseErrorSchema = (zodErrors: z.ZodIssue[]) => { export const zodResolver: Resolver = (schema) => async (values) => { try { - await schema.parse(values); + await schema.parseAsync(values); return {}; } catch (error: any) { From 7c9e33c1017dfc11064937f911441a099c279ca3 Mon Sep 17 00:00:00 2001 From: Alex Liu Date: Tue, 10 Oct 2023 18:12:46 +0800 Subject: [PATCH 2/2] fix(resolvers): ensure correct async validation for valibot --- packages/resolvers/valibot/src/valibot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/resolvers/valibot/src/valibot.ts b/packages/resolvers/valibot/src/valibot.ts index 3ea7496..7103fe4 100644 --- a/packages/resolvers/valibot/src/valibot.ts +++ b/packages/resolvers/valibot/src/valibot.ts @@ -1,5 +1,5 @@ import { toNestError } from '@vorms/resolvers'; -import { parse } from 'valibot'; +import { parseAsync } from 'valibot'; import type { Resolver } from './types'; import type { Issues } from 'valibot'; @@ -26,7 +26,7 @@ const parseErrorSchema = (valibotIssues: Issues) => { export const valibotResolver: Resolver = (schema) => async (values) => { try { - parse(schema, values); + await parseAsync(schema, values); return {}; } catch (error: any) { if (error.name !== 'ValiError') throw error;