如何在@nestjs/swagger 中的嵌套箭头处使用“dto”设置默认值;

问题描述

它确实以这种方式工作:

  @prop()
  @ApiProperty({
    description: "正面内容",type: 'array',items: {
      type: 'array',items: {
        default: {
           aa:33,bb:44
        }
      }
    }
  })
 front: TplParentData[][]
enter image description here

但它没有以这种方式工作:

 class dto{
    @prop({ default: 33 })
    @ApiProperty({ example: 33 })
    a: number

    @prop({ default: 44 })
    @ApiProperty({ example: 44 })
    b: number
  }

  @prop()
  @ApiProperty({
    description: "正面内容",items: {
        default:dto
      }
    }
  })
  front: TplParentData[][]
enter image description here

问题:如何在这个地方使用“dto”类?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)