mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
fix(Form): standard schema validation no longer wrapped in value object (#3104)
This commit is contained in:
@@ -47,9 +47,7 @@ export async function validateStandardSchema(
|
||||
state: any,
|
||||
schema: StandardSchemaV1
|
||||
): Promise<ValidateReturnSchema<typeof state>> {
|
||||
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<T extends object>(state: T, schema: FormSchema<T>
|
||||
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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user