From e0e86cdf6b882e33099cf628074febae62b278ee Mon Sep 17 00:00:00 2001 From: ap <951984189@qq.com> Date: Mon, 10 Jan 2022 18:28:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/modules/demo/controller/app/swagger.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/modules/demo/controller/app/swagger.ts b/src/app/modules/demo/controller/app/swagger.ts index 0f58766..f4a469a 100644 --- a/src/app/modules/demo/controller/app/swagger.ts +++ b/src/app/modules/demo/controller/app/swagger.ts @@ -14,10 +14,16 @@ export class DemoSwaggerController extends BaseController { @CreateApiDoc() .summary('hello 接口') .description('hello 接口功能描述') - .param('姓名') + .param('姓名', { required: true }) + .param('年龄', { required: true }) + .param('简介', { required: false }) .build() @Get('/hello') - async hello(@Query() name: string) { - return this.ok(`你好:${name}!!`); + async hello( + @Query() name: string, + @Query() age: number, + @Query() desc: string + ) { + return this.ok(`你好:${name}!! ${age} ${desc}`); } }