Support both presence constraint variants (#12617)

This commit is contained in:
melohagan 2023-12-19 11:02:39 +00:00 committed by GitHub
parent 3697ff3efc
commit 3f11597251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -164,7 +164,8 @@
// Required constraint // Required constraint
if ( if (
field === dataSourceSchema?.table?.primaryDisplay || field === dataSourceSchema?.table?.primaryDisplay ||
constraints.presence?.allowEmpty === false constraints.presence?.allowEmpty === false ||
constraints.presence === true
) { ) {
rules.push({ rules.push({
constraint: "required", constraint: "required",

View File

@ -23,7 +23,8 @@ export const createValidatorFromConstraints = (
// Required constraint // Required constraint
if ( if (
field === table?.primaryDisplay || field === table?.primaryDisplay ||
schemaConstraints.presence?.allowEmpty === false schemaConstraints.presence?.allowEmpty === false ||
schemaConstraints.presence === true
) { ) {
rules.push({ rules.push({
type: schemaConstraints.type == "array" ? "array" : "string", type: schemaConstraints.type == "array" ? "array" : "string",