Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
fixed(server): fixed simple validation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiisol committed Aug 6, 2023
1 parent b0d748a commit 7358215
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@
]
}
},
"version": "1.0.0-beta.5"
"version": "1.0.0-beta.6"
}
10 changes: 5 additions & 5 deletions server/src/core/helpers/param-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@ export class ParamValidator {
continue;
}

if (!this.hasDecorators(type)) {
continue;
}

const instance = plainToInstance(type as ClassConstructor, arg);

if (instance instanceof type) {
if (this.hasDecorators(type)) {
const errors = await validate(instance, { validationError: { target: false } });

if (errors.length) {
Expand All @@ -35,6 +31,10 @@ export class ParamValidator {
continue;
}

if (instance instanceof type) {
continue;
}

throw new BadRequestError(
`Invalid param “${params[i].argName}”. “${params[i].validator.name}” expected, “${typeof arg}” received`,
);
Expand Down

0 comments on commit 7358215

Please sign in to comment.