From 8f7f579da0fc58575184dc445ff0dda0c0ca1298 Mon Sep 17 00:00:00 2001 From: Gerben Mulder Date: Fri, 24 Jan 2025 18:21:52 +0100 Subject: [PATCH] fix(Form): standard schema validation no longer wrapped in `value` object (#3104) --- src/runtime/utils/form.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/runtime/utils/form.ts b/src/runtime/utils/form.ts index e2ba4329aa..160ba8f8b7 100644 --- a/src/runtime/utils/form.ts +++ b/src/runtime/utils/form.ts @@ -47,9 +47,7 @@ export async function validateStandardSchema( state: any, schema: StandardSchemaV1 ): Promise> { - const result = await schema['~standard'].validate({ - value: state - }) + const result = await schema['~standard'].validate(state) if (result.issues) { return { @@ -197,14 +195,14 @@ export function validateSchema(state: T, schema: FormSchema return validateZodSchema(state, schema) } else if (isJoiSchema(schema)) { return validateJoiSchema(state, schema) + } else if (isStandardSchema(schema)) { + return validateStandardSchema(state, schema) } else if (isValibotSchema(schema)) { return validateValibotSchema(state, schema) } else if (isYupSchema(schema)) { return validateYupSchema(state, schema) } else if (isSuperStructSchema(schema)) { return validateSuperstructSchema(state, schema) - } else if (isStandardSchema(schema)) { - return validateStandardSchema(state, schema) } else { throw new Error('Form validation failed: Unsupported form schema') }