| 1069 | @private |
| 1070 | */ |
| 1071 | validate(value, field, options) { |
| 1072 | if (this.typeValidation && field.type.validate && value) { |
| 1073 | try { |
| 1074 | if (options.isList && Array.isArray(value)) { |
| 1075 | for (const item of value) { |
| 1076 | field.type.validate(item, options); |
| 1077 | } |
| 1078 | } else { |
| 1079 | field.type.validate(value, options); |
| 1080 | } |
| 1081 | } catch (error) { |
| 1082 | if (error instanceof sequelizeError.ValidationError) { |
| 1083 | error.errors.push(new sequelizeError.ValidationErrorItem( |
| 1084 | error.message, |
| 1085 | class="st">'Validation error', |
| 1086 | field.fieldName, |
| 1087 | value, |
| 1088 | null, |
| 1089 | `${field.type.key} validator` |
| 1090 | )); |
| 1091 | } |
| 1092 | |
| 1093 | throw error; |
| 1094 | } |
| 1095 | } |
| 1096 | } |
| 1097 | |
| 1098 | isIdentifierQuoted(identifier) { |
| 1099 | return /^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(identifier); |