【发布时间】:2021-03-13 11:36:38
【问题描述】:
我正在编写一个NestJS 应用程序。现在我要安装Express中间件express-openapi-validator。
但是,我无法让它工作。有description for how to install the express-openapi-validator in express,但是总是会报错。
例如
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer.apply(middleware({apiSpec "./bff-api.yaml"}))
.forRoutes(OrganizationController)
}
}
结果
error TS2345: Argument of type 'OpenApiRequestHandler[]' is not assignable to parameter of type 'Function | Type<any>'.
Type 'OpenApiRequestHandler[]' is missing the following properties from type 'Type<any>': apply, call, bind, prototype, and 4 more.
如何在 NestJS 中安装这个中间件?
【问题讨论】:
标签: express validation nestjs middleware openapi