Skip to content

Commit a98f5dd

Browse files
nolazybitsvlapo
authored andcommitted
fix: create instance of ValidationError for whitelist errors (#434)
Fix #325
1 parent b4c7781 commit a98f5dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/validation/ValidationExecutor.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ export class ValidationExecutor {
111111

112112
// throw errors
113113
notAllowedProperties.forEach(property => {
114-
validationErrors.push({
115-
target: object, property, value: (object as any)[property], children: undefined,
116-
constraints: { [ValidationTypes.WHITELIST]: `property ${property} should not exist` }
117-
});
114+
const validationError: ValidationError = this.generateValidationError(object, (object as any)[property], property);
115+
validationError.constraints = { [ValidationTypes.WHITELIST]: `property ${property} should not exist` };
116+
validationError.children = undefined;
117+
validationErrors.push(validationError);
118118
});
119119

120120
} else {

0 commit comments

Comments
 (0)