Fix schema require checks

This commit is contained in:
Adria Navarro 2024-08-02 13:12:47 +02:00
parent 616b1bf012
commit cd1a7699b2
1 changed files with 6 additions and 1 deletions

View File

@ -84,7 +84,7 @@ export function validate(
"Column names can't contain special characters"
} else if (
columnData == null &&
!schema[columnName].constraints?.presence
!helpers.schema.isRequired(constraints)
) {
results.schemaValidation[columnName] = true
} else if (
@ -94,6 +94,11 @@ export function validate(
isAutoColumn
) {
return
} else if (
[FieldType.STRING].includes(columnType) &&
helpers.schema.isRequired(constraints)
) {
results.schemaValidation[columnName] = false
} else if (columnType === FieldType.NUMBER && isNaN(Number(columnData))) {
// If provided must be a valid number
results.schemaValidation[columnName] = false