Merge branch 'fix/inp-obj' into 'release'
Text validation fails with a stringified value Closes #386 See merge request theappsmith/internal-tools-client!196
This commit is contained in:
commit
fe6df3450e
|
|
@ -11,13 +11,20 @@ import { WIDGET_TYPE_VALIDATION_ERROR } from "constants/messages";
|
||||||
export const VALIDATORS: Record<ValidationType, Validator> = {
|
export const VALIDATORS: Record<ValidationType, Validator> = {
|
||||||
[VALIDATION_TYPES.TEXT]: (value: any): ValidationResponse => {
|
[VALIDATION_TYPES.TEXT]: (value: any): ValidationResponse => {
|
||||||
let parsed = value;
|
let parsed = value;
|
||||||
if (_.isUndefined(value) || _.isObject(value)) {
|
if (_.isUndefined(value)) {
|
||||||
return {
|
return {
|
||||||
isValid: false,
|
isValid: false,
|
||||||
parsed: "",
|
parsed: "",
|
||||||
message: `${WIDGET_TYPE_VALIDATION_ERROR}: text`,
|
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);
|
let isValid = _.isString(value);
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user