【发布时间】:2021-09-25 05:28:47
【问题描述】:
我有以下代表响应的类:
class SomeResponse {
property1?: string;
[key: string]: string
}
我想使用 nest-cli 为这个响应生成正确的 swagger 文档。
它适用于我的所有其他simpler 属性,即property1 在招摇中正确显示。
我也试过直接注释:
class SomeResponse {
property1?: string;
@ApiProperty()
[key: string]: string
}
但这是不允许的,因为它给出:error TS1206: Decorators are not valid here.
有没有办法手动注释或使用像[key: string]: string 这样的nest-cli 结构?
【问题讨论】:
标签: typescript swagger nestjs