mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 05:56:31 +08:00
refactor: make validateJSONSchema type-safe
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-Claude) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
03ec2f64cd
commit
3bdc16ac5f
@ -42,7 +42,7 @@ export const toEnvVarInInspect = (envVar: EnvironmentVariable): VarInInspect =>
|
||||
}
|
||||
}
|
||||
|
||||
export const validateJSONSchema = (schema: any, type: string) => {
|
||||
export const validateJSONSchema = (schema: unknown, type: string): z.SafeParseReturnType<unknown, unknown> => {
|
||||
if (type === 'array[string]') {
|
||||
const result = arrayStringSchemaParttern.safeParse(schema)
|
||||
return result
|
||||
@ -60,7 +60,7 @@ export const validateJSONSchema = (schema: any, type: string) => {
|
||||
return result
|
||||
}
|
||||
else {
|
||||
return { success: true } as any
|
||||
return z.unknown().safeParse(schema)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user