mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-17 13:22:42 +01:00
add proper boolean validation to field (#4283)
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
This commit is contained in:
parent
63692a6bd3
commit
cf1b7e7a93
@ -16,7 +16,15 @@ export function createValidationSchema(json_values: Record<string, any>) {
|
||||
|
||||
const displayName = getDisplayNameForCredentialKey(key);
|
||||
|
||||
if (json_values[key] === null) {
|
||||
if (typeof json_values[key] === "boolean") {
|
||||
// Ensure false is considered valid
|
||||
schemaFields[key] = Yup.boolean()
|
||||
.nullable()
|
||||
.default(false)
|
||||
.transform((value, originalValue) =>
|
||||
originalValue === undefined ? false : value
|
||||
);
|
||||
} else if (json_values[key] === null) {
|
||||
// Field is optional:
|
||||
schemaFields[key] = Yup.string()
|
||||
.trim()
|
||||
|
Loading…
x
Reference in New Issue
Block a user