我有以下获取请求:
/api?entitiesText=["america", "americans"]&phrasesText=["a month-long effort"]
我想转换entitiesText
并:phrasesText
string[]
export class ContentEnrichmentQuery {
@IsArray()
entitiesText?: string[];
@IsArray()
phrasesText?: string[];
}
这是方法:
@Get('/toppings')
async getViaPost(@Query(new ValidationPipe({ transform: true })) contentEnrichmentQuery: ContentEnrichmentQuery) {....}
现在我得到它们string
而不是string[]