From 9616657d4d1ac190fbbd406f7b4b8c17418ce9d2 Mon Sep 17 00:00:00 2001 From: brightestboy Date: Thu, 21 Mar 2019 10:51:25 +0800 Subject: [PATCH] =?UTF-8?q?SwaggerUi=EF=BC=9A=E8=A1=A5=E5=85=85=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E5=85=B6=E4=BB=96=E4=BF=A1=E6=81=AF=EF=BC=88Scheme?= =?UTF-8?q?=E3=80=81externalDoc=E3=80=81securityDefinition=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/rep/api/SwaggerDocService.scala | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/scala/rep/api/SwaggerDocService.scala b/src/main/scala/rep/api/SwaggerDocService.scala index 0ff815e1..a79c3854 100644 --- a/src/main/scala/rep/api/SwaggerDocService.scala +++ b/src/main/scala/rep/api/SwaggerDocService.scala @@ -22,7 +22,7 @@ import com.github.swagger.akka.SwaggerHttpService import com.github.swagger.akka.SwaggerHttpService.prependSlashIfNecessary import com.github.swagger.akka.model.{Info, License} import rep.api.rest._ -import io.swagger.models.{ExternalDocs, Swagger, Tag} +import io.swagger.models.{ExternalDocs, Scheme, Swagger, Tag} import io.swagger.models.auth.BasicAuthDefinition /**集成Swagger到AKKA HTTP @@ -47,14 +47,16 @@ object SwaggerDocService extends SwaggerHttpService { license = Some(License("Apache 2.0","http://www.apache.org/licenses/LICENSE-2.0.html"))) /** * 重写swaggerConfig,加上tag描述信息 - * @author zyf line 52-57 + * @author zyf */ val tagList = new ArrayList[Tag]() tagList.add(new Tag().name("logmgr").description("日志信息管理")) tagList.add(new Tag().name("chaininfo").description("获得当前区块链信息")) tagList.add(new Tag().name("block").description("获得区块数据")) tagList.add(new Tag().name("transaction").description("获得交易数据或提交交易")) - override val swaggerConfig = new Swagger().basePath(prependSlashIfNecessary(basePath)).info(info).tags(tagList) - override val externalDocs = Some(new ExternalDocs("Developers Guide", "https://repchaindoc.readthedocs.io/zh/latest/index.html")) - override val securitySchemeDefinitions = Map("basicAuth" -> new BasicAuthDefinition()) + override val swaggerConfig = new Swagger().basePath(prependSlashIfNecessary(basePath)).info(info) + .scheme(Scheme.HTTP).tags(tagList).securityDefinition("basicAuth", new BasicAuthDefinition()) + .externalDocs(new ExternalDocs("Developers Guide", "https://repchaindoc.readthedocs.io/zh/latest/index.html")) +// override val externalDocs = Some(new ExternalDocs("Developers Guide", "https://repchaindoc.readthedocs.io/zh/latest/index.html")) +// override val securitySchemeDefinitions = Map("basicAuth" -> new BasicAuthDefinition()) } \ No newline at end of file