From 6dfadd13ddf75f41bc4c2f468f027ecf24e9caee Mon Sep 17 00:00:00 2001 From: caixw Date: Sat, 23 Nov 2024 09:30:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor(plugins/openapi/swagger):=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=20displayOperationId=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/openapi/openapi.go | 2 +- plugins/openapi/swagger/swagger.go | 6 +++--- plugins/openapi/swagger/swagger.html | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/openapi/openapi.go b/plugins/openapi/openapi.go index 754fd2b..b26a85f 100644 --- a/plugins/openapi/openapi.go +++ b/plugins/openapi/openapi.go @@ -2,5 +2,5 @@ // // SPDX-License-Identifier: MIT -// package openapi 提供 [github.com/isse9/web/openapi] 文档的阅读器 +// package openapi 提供 [github.com/issue9/web/openapi] 文档的阅读器 package openapi diff --git a/plugins/openapi/swagger/swagger.go b/plugins/openapi/swagger/swagger.go index bc91f34..8aab3d4 100644 --- a/plugins/openapi/swagger/swagger.go +++ b/plugins/openapi/swagger/swagger.go @@ -33,11 +33,11 @@ func Install(s web.Server) { // 可用来代替 [openapi.WithHTML] // // assets swagger 的页面资源,可以直接引用 [OnlineAssets],也可以指向自有的服务器; -// favicon 图标, +// logo 图标; // // [swagger]: https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/ -func WithHTML(assets, favicon string) openapi.Option { - return openapi.WithHTML("swagger", assets, favicon) +func WithHTML(assets, logo string) openapi.Option { + return openapi.WithHTML("swagger", assets, logo) } // WithOnlineHTML 采用 [OnlineAssets] 作为参数的 [WithHTML] 版本 diff --git a/plugins/openapi/swagger/swagger.html b/plugins/openapi/swagger/swagger.html index 1ca0478..9ed85fe 100644 --- a/plugins/openapi/swagger/swagger.html +++ b/plugins/openapi/swagger/swagger.html @@ -7,7 +7,7 @@ {{.Info.Title}} {{if .Info.Description}}{{end}} - {{if .XFavicon}}{{end}} + {{if .XLogo}}{{end}} @@ -19,7 +19,6 @@ window.ui = SwaggerUIBundle({ spec: {{ json . }}, dom_id: '#swagger-ui', - displayOperationId: true, }); };