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') }