mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 22:40:24 +00:00
Fixes 1823
This commit is contained in:
parent
63b44b173e
commit
f593a441e6
@ -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 */
|
/* eslint-disable consistent-return */
|
||||||
export function getValidationsFromForm(form, formValidations) {
|
export function getValidationsFromForm(form, formValidations) {
|
||||||
@ -88,7 +101,7 @@ function validate(value, validations) {
|
|||||||
case 'type':
|
case 'type':
|
||||||
if (validationValue === 'json') {
|
if (validationValue === 'json') {
|
||||||
try {
|
try {
|
||||||
if (isObject(value)) {
|
if (isObject(value) || isBoolean(value) || isNumber(value) || isArray(value)) {
|
||||||
value = JSON.parse(JSON.stringify(value));
|
value = JSON.parse(JSON.stringify(value));
|
||||||
} else {
|
} else {
|
||||||
errors.push({ id: 'content-manager.error.validation.json' });
|
errors.push({ id: 'content-manager.error.validation.json' });
|
||||||
|
0
packages/strapi/bin/strapi.js
Normal file → Executable file
0
packages/strapi/bin/strapi.js
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user