We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello @Mohammad-Faisal, nice simple to follow tutorial.
I noticed an issue with the RequestValidator; it duplicates the validation error messages. See screenshot below.
The expected message should look like this:
And was fixed with this change:
export default class RequestValidator { static validate = <T extends object>(classInstance: ClassConstructor<T>) => { return async (req: Request, res: Response, next: NextFunction) => { const convertedObject = plainToInstance(classInstance, req.body); const errors = await validate(convertedObject); if (errors.length > 0) { let rawErrors: string[] = []; for (const errorItem of errors) { rawErrors = rawErrors.concat(...Object.values(errorItem.constraints ?? [])); } const validationErrorText = 'Request validation failed!'; console.log('error found!', rawErrors); next(new BadRequestError(validationErrorText, rawErrors)); } next(); }; }; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello @Mohammad-Faisal, nice simple to follow tutorial.
I noticed an issue with the RequestValidator; it duplicates the validation error messages. See screenshot below.
The expected message should look like this:
And was fixed with this change:
The text was updated successfully, but these errors were encountered: