refactor(Form): rename validation functions and vars for clarity (#3029)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Romain Hamel
2025-01-13 11:19:29 +01:00
committed by GitHub
parent 9d0f8617b2
commit 1a54ab231b
4 changed files with 14 additions and 13 deletions

View File

@@ -43,7 +43,7 @@ export function isStandardSchema(schema: any): schema is StandardSchemaV1 {
return '~standard' in schema
}
export async function validateStandarSchema(
export async function validateStandardSchema(
state: any,
schema: StandardSchemaV1
): Promise<ValidateReturnSchema<typeof state>> {
@@ -192,7 +192,7 @@ async function validateValibotSchema(
}
}
export function parseSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>> {
export function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>> {
if (isZodSchema(schema)) {
return validateZodSchema(state, schema)
} else if (isJoiSchema(schema)) {
@@ -204,7 +204,7 @@ export function parseSchema<T extends object>(state: T, schema: FormSchema<T>):
} else if (isSuperStructSchema(schema)) {
return validateSuperstructSchema(state, schema)
} else if (isStandardSchema(schema)) {
return validateStandarSchema(state, schema)
return validateStandardSchema(state, schema)
} else {
throw new Error('Form validation failed: Unsupported form schema')
}