( dto: ClassConstructor<T>, obj: unknown, )
| 13 | } |
| 14 | |
| 15 | export const validateDTO = async <T>( |
| 16 | dto: ClassConstructor<T>, |
| 17 | obj: unknown, |
| 18 | ) => { |
| 19 | const instance = plainToInstance(dto, obj); |
| 20 | const errors = await validate(instance as object); |
| 21 | if (errors.length > 0) { |
| 22 | throw new ValidationErrorContainer(dto.name, errors); |
| 23 | } |
| 24 | return instance; |
| 25 | }; |
no outgoing calls
no test coverage detected