Fixes 1823

This commit is contained in:
cyril lopez 2018-09-28 12:24:11 +02:00
parent 63b44b173e
commit f593a441e6
2 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,17 @@
import { forEach, isObject, isArray, map, mapKeys, includes, reject, isEmpty, findIndex, isUndefined } from 'lodash';
import {
forEach,
isObject,
isArray,
map,
mapKeys,
includes,
reject,
isEmpty,
findIndex,
isUndefined,
isBoolean,
isNumber,
} from 'lodash';
/* eslint-disable consistent-return */
export function getValidationsFromForm(form, formValidations) {
@ -88,7 +101,7 @@ function validate(value, validations) {
case 'type':
if (validationValue === 'json') {
try {
if (isObject(value)) {
if (isObject(value) || isBoolean(value) || isNumber(value) || isArray(value)) {
value = JSON.parse(JSON.stringify(value));
} else {
errors.push({ id: 'content-manager.error.validation.json' });

0
packages/strapi/bin/strapi.js Normal file → Executable file
View File