0

我对 class-trasnforer 或 class-validator 有一些奇怪的问题。我想通过 ValidationPipe 从发布请求中验证正文。Body Schema 应如下所示:

{
"position": 3,
"dateOfEvent": "2021-02-23",
"contractor": {
    "name": "Cristiano",
    "surname": "Ronaldo",
    "companyName": "CR7 Company",
},
"income": {
    "soldGoods": 232323,
    "totalGoods": 3232323
},
"expenses": {
    "total": 3232
}

}

我想验证此对象中的所有字段 - 包括嵌套对象,如“承包商”、“费用”、“收入”。所以我使用了@type 装饰器,但我遇到了一个错误: invoiceValidation_decorator_1.IncomeSoldValidator is not a function 但是!承包商字段与收入和费用具有相同的代码,但即便如此,收入和费用也会返回错误。有谁知道发生了什么?github要点:https ://gist.github.com/Chester97/0f5fecc8d25b55e59e2f25328a60f13e

4

0 回答 0