zeromicro/goctl-swagger

希望 Authorize 的 name 可配置

MasterJoyHunan opened this issue · 4 comments

"securityDefinitions": {
    "apiKey": {
      "type": "apiKey",
      "description": "Enter JWT Bearer token **_only_**",
      "name": "Authorization", # 有时会使用自定义的 key 
      "in": "header"
    }
  }

在你的工具中已经写死了

newSecDefValue.Name = "Authorization"

asppj commented

好像是没人维护了

kevwan commented

@MaxToby PTAL.

我基于这个重新写了插件,支持了这个,你可以试试:

go install github.com/xing393939/gotools/cmd/gozero-swagger@latest
goctl api plugin -plugin gozero-swagger="swagger -host localhost:8888" -api gateway.api -dir .


// api文件的@server块这样写:
@server(
	header: token  // Authorize name就是token
)