From 6c47ee15f2c49b4e88529a17a08eaf9c34f0af8c Mon Sep 17 00:00:00 2001 From: Satbir Date: Wed, 18 Dec 2019 18:05:06 +0530 Subject: [PATCH] Text validation fails with a stringified value --- app/client/src/utils/Validators.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/client/src/utils/Validators.ts b/app/client/src/utils/Validators.ts index 1ad8427f08..1b950e96ef 100644 --- a/app/client/src/utils/Validators.ts +++ b/app/client/src/utils/Validators.ts @@ -11,13 +11,20 @@ import { WIDGET_TYPE_VALIDATION_ERROR } from "constants/messages"; export const VALIDATORS: Record = { [VALIDATION_TYPES.TEXT]: (value: any): ValidationResponse => { let parsed = value; - if (_.isUndefined(value) || _.isObject(value)) { + if (_.isUndefined(value)) { return { isValid: false, parsed: "", message: `${WIDGET_TYPE_VALIDATION_ERROR}: text`, }; } + if (_.isObject(value)) { + return { + isValid: false, + parsed: JSON.stringify(value, null, 2), + message: `${WIDGET_TYPE_VALIDATION_ERROR}: text`, + }; + } let isValid = _.isString(value); if (!isValid) { try {