Skip to content

[Info] How to update Swagger annotations in CB Tumblebug

Yunkon Kim edited this page Aug 2, 2023 · 1 revision

[Download Swag for Go] (Do only once) (FYI: Swag converts Go annotations to Swagger Documentation 2.0.)

$ go get github.com/swaggo/swag/cmd/swag

[Optional: Add ~/go/bin to your $PATH] (Do only once)

Add lines like these in your .bashrc or .zshrc:

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

[Update Swagger annotations in these files:]


[Convert Go annotations to Swagger Documentation 2.0]

In cb-tumblebug/src, run one of these:

  • swag i
  • swag init
  • ~/go/bin/swag i
  • ~/go/bin/swag init
2020/07/29 15:26:03 Generate swagger docs....
2020/07/29 15:26:03 Generate general API Info, search dir:./
2020/07/29 15:26:04 Generating mcis.TbMcisReq
2020/07/29 15:26:04 Generating mcis.TbVmReq
2020/07/29 15:26:04 Generating mcis.TbMcisInfo
2020/07/29 15:26:04 Generating mcis.TbVmInfo
2020/07/29 15:26:04 Generating mcis.GeoLocation
2020/07/29 15:26:04 Generating mcis.RegionInfo
2020/07/29 15:26:04 Generating mcis.SpiderVMInfo
2020/07/29 15:26:04 Generating common.IID
2020/07/29 15:26:04 Generating common.KeyValue
2020/07/29 15:26:04 Generating common.SimpleMsg
2020/07/29 15:26:04 Generating mcis.RestGetAllMcisResponse
2020/07/29 15:26:04 Generating mcis.McisRecommendReq
2020/07/29 15:26:04 Generating mcis.TbVmRecommendReq
2020/07/29 15:26:04 Generating mcis.RestPostMcisRecommandResponse
2020/07/29 15:26:04 Generating mcis.TbVmRecommendInfo
2020/07/29 15:26:04 Generating mcis.TbVmPriority
2020/07/29 15:26:04 Generating mcir.TbSpecInfo
2020/07/29 15:26:04 Generating mcis.McisCmdReq
2020/07/29 15:26:04 Generating mcis.RestPostCmdMcisVmResponse
2020/07/29 15:26:04 Generating mcis.RestPostCmdMcisResponseWrapper
2020/07/29 15:26:04 Generating mcis.RestPostCmdMcisResponse
2020/07/29 15:26:04 Generating mcis.AgentInstallContentWrapper
2020/07/29 15:26:04 Generating mcis.AgentInstallContent
2020/07/29 15:26:04 Generating mcis.RestGetAllBenchmarkRequest
2020/07/29 15:26:04 Generating mcis.BenchmarkInfoArray
2020/07/29 15:26:04 Generating mcis.BenchmarkInfo
2020/07/29 15:26:04 Skipping 'mcis.BenchmarkInfo', recursion detected.
2020/07/29 15:26:04 Generating mcis.RestGetBenchmarkRequest
2020/07/29 15:26:04 Generating mcir.TbSshKeyInfo
2020/07/29 15:26:04 Generating mcir.TbSpecReq
2020/07/29 15:26:04 Generating mcir.RestLookupSpecRequest
2020/07/29 15:26:04 Generating mcir.SpiderSpecInfo
2020/07/29 15:26:04 Generating mcir.SpiderVCpuInfo
2020/07/29 15:26:04 Generating mcir.SpiderGpuInfo
2020/07/29 15:26:04 Generating mcir.SpiderSpecList
2020/07/29 15:26:04 Generating mcir.RestGetAllSpecResponse
2020/07/29 15:26:04 Generating mcir.TbSshKeyReq
2020/07/29 15:26:04 Generating mcir.RestGetAllSshKeyResponse
2020/07/29 15:26:04 Generating mcir.TbSecurityGroupReq
2020/07/29 15:26:04 Generating mcir.SpiderSecurityRuleInfo
2020/07/29 15:26:04 Generating mcir.TbSecurityGroupInfo
2020/07/29 15:26:04 Generating mcir.RestGetAllSecurityGroupResponse
2020/07/29 15:26:04 Generating mcir.TbVNetReq
2020/07/29 15:26:04 Generating mcir.SpiderSubnetReqInfo
2020/07/29 15:26:04 Generating mcir.TbVNetInfo
2020/07/29 15:26:04 Generating mcir.SpiderSubnetInfo
2020/07/29 15:26:04 Generating mcir.RestGetAllVNetResponse
2020/07/29 15:26:04 Generating mcir.TbImageInfo
2020/07/29 15:26:04 Generating mcir.TbImageReq
2020/07/29 15:26:04 Generating mcir.RestGetAllImageResponse
2020/07/29 15:26:04 Generating common.RestGetAllNsResponse
2020/07/29 15:26:04 Generating common.NsInfo
2020/07/29 15:26:04 Generating common.NsReq
2020/07/29 15:26:04 create docs.go at docs/docs.go
2020/07/29 15:26:04 create swagger.json at docs/swagger.json
2020/07/29 15:26:04 create swagger.yaml at docs/swagger.yaml

→ These files will be updated:

  • cb-tumblebug/src/docs/docs.go
  • cb-tumblebug/src/docs/swagger.json
  • cb-tumblebug/src/docs/swagger.yaml

[Build CB-Tumblebug binary]

In cb-tumblebug/src, run make && make run and test.


[Post an PR containing your updates to this repo]

Clone this wiki locally