mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 19:57:55 +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,
|
state: any,
|
||||||
schema: StandardSchemaV1
|
schema: StandardSchemaV1
|
||||||
): Promise<ValidateReturnSchema<typeof state>> {
|
): Promise<ValidateReturnSchema<typeof state>> {
|
||||||
const result = await schema['~standard'].validate({
|
const result = await schema['~standard'].validate(state)
|
||||||
value: state
|
|
||||||
})
|
|
||||||
|
|
||||||
if (result.issues) {
|
if (result.issues) {
|
||||||
return {
|
return {
|
||||||
@@ -197,14 +195,14 @@ export function validateSchema<T extends object>(state: T, schema: FormSchema<T>
|
|||||||
return validateZodSchema(state, schema)
|
return validateZodSchema(state, schema)
|
||||||
} else if (isJoiSchema(schema)) {
|
} else if (isJoiSchema(schema)) {
|
||||||
return validateJoiSchema(state, schema)
|
return validateJoiSchema(state, schema)
|
||||||
|
} else if (isStandardSchema(schema)) {
|
||||||
|
return validateStandardSchema(state, schema)
|
||||||
} else if (isValibotSchema(schema)) {
|
} else if (isValibotSchema(schema)) {
|
||||||
return validateValibotSchema(state, schema)
|
return validateValibotSchema(state, schema)
|
||||||
} else if (isYupSchema(schema)) {
|
} else if (isYupSchema(schema)) {
|
||||||
return validateYupSchema(state, schema)
|
return validateYupSchema(state, schema)
|
||||||
} else if (isSuperStructSchema(schema)) {
|
} else if (isSuperStructSchema(schema)) {
|
||||||
return validateSuperstructSchema(state, schema)
|
return validateSuperstructSchema(state, schema)
|
||||||
} else if (isStandardSchema(schema)) {
|
|
||||||
return validateStandardSchema(state, schema)
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Form validation failed: Unsupported form schema')
|
throw new Error('Form validation failed: Unsupported form schema')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user