From 3f115972514df8b5d802711f6b583181c509b087 Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:02:39 +0000 Subject: [PATCH] Support both presence constraint variants (#12617) --- .../settings/controls/ValidationEditor/ValidationDrawer.svelte | 3 ++- packages/client/src/components/app/forms/validation.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationDrawer.svelte b/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationDrawer.svelte index 0bff2ccce6..cd50f526b5 100644 --- a/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/ValidationEditor/ValidationDrawer.svelte @@ -164,7 +164,8 @@ // Required constraint if ( field === dataSourceSchema?.table?.primaryDisplay || - constraints.presence?.allowEmpty === false + constraints.presence?.allowEmpty === false || + constraints.presence === true ) { rules.push({ constraint: "required", diff --git a/packages/client/src/components/app/forms/validation.js b/packages/client/src/components/app/forms/validation.js index 9224572c10..3b3a5d6e1d 100644 --- a/packages/client/src/components/app/forms/validation.js +++ b/packages/client/src/components/app/forms/validation.js @@ -23,7 +23,8 @@ export const createValidatorFromConstraints = ( // Required constraint if ( field === table?.primaryDisplay || - schemaConstraints.presence?.allowEmpty === false + schemaConstraints.presence?.allowEmpty === false || + schemaConstraints.presence === true ) { rules.push({ type: schemaConstraints.type == "array" ? "array" : "string",