Skip to content

Commit

Permalink
fix: create instance of ValidationError for whitelist errors (#434)
Browse files Browse the repository at this point in the history
Fix #325
  • Loading branch information
nolazybits authored and vlapo committed Oct 15, 2019
1 parent b4c7781 commit a98f5dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/validation/ValidationExecutor.ts
Expand Up @@ -111,10 +111,10 @@ export class ValidationExecutor {

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

} else {
Expand Down

0 comments on commit a98f5dd

Please sign in to comment.