Skip to content

Commit

Permalink
update the swagger dependency
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Jun 20, 2022
1 parent eb2ed76 commit 419bc7a
Show file tree
Hide file tree
Showing 31 changed files with 1,034 additions and 1,007 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,8 @@ docker-image:
#### Build utils ###

swagger-spec: install-tools
go mod vendor
swag init --parseVendor --generalInfo server/api/router.go --exclude vendor/github.com/pingcap/tidb-dashboard --output docs/swagger
go mod tidy
rm -rf vendor
swag init --parseDependency --parseInternal --parseDepth 1 --dir server --generalInfo api/router.go --output docs/swagger
swag fmt --dir server

dashboard-ui:
./scripts/embed-dashboard-ui.sh
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba
github.com/swaggo/swag v1.6.6-0.20200529100950-7c765ddd0476
github.com/swaggo/swag v1.8.3
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965
github.com/tidwall/gjson v1.9.3 // indirect
github.com/unrolled/render v1.0.1
Expand All @@ -50,9 +50,9 @@ require (
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738
go.uber.org/goleak v1.1.12
go.uber.org/zap v1.19.1
golang.org/x/text v0.3.3
golang.org/x/text v0.3.7
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
golang.org/x/tools v0.1.5
golang.org/x/tools v0.1.10
google.golang.org/grpc v1.26.0
gotest.tools/gotestsum v1.7.0
)
63 changes: 46 additions & 17 deletions go.sum

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions server/api/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ func newAdminHandler(svr *server.Server, rd *render.Render) *adminHandler {
}
}

// @Tags admin
// @Summary Drop a specific region from cache.
// @Param id path integer true "Region Id"
// @Produce json
// @Success 200 {string} string "The region is removed from server cache."
// @Failure 400 {string} string "The input is invalid."
// @Router /admin/cache/region/{id} [delete]
// @Tags admin
// @Summary Drop a specific region from cache.
// @Param id path integer true "Region Id"
// @Produce json
// @Success 200 {string} string "The region is removed from server cache."
// @Failure 400 {string} string "The input is invalid."
// @Router /admin/cache/region/{id} [delete]
func (h *adminHandler) DeleteRegionCache(w http.ResponseWriter, r *http.Request) {
rc := getCluster(r)
vars := mux.Vars(r)
Expand All @@ -59,16 +59,16 @@ func (h *adminHandler) DeleteRegionCache(w http.ResponseWriter, r *http.Request)
}

// FIXME: details of input json body params
// @Tags admin
// @Summary Reset the ts.
// @Accept json
// @Param body body object true "json params"
// @Produce json
// @Success 200 {string} string "Reset ts successfully."
// @Failure 400 {string} string "The input is invalid."
// @Failure 403 {string} string "Reset ts is forbidden."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /admin/reset-ts [post]
// @Tags admin
// @Summary Reset the ts.
// @Accept json
// @Param body body object true "json params"
// @Produce json
// @Success 200 {string} string "Reset ts successfully."
// @Failure 400 {string} string "The input is invalid."
// @Failure 403 {string} string "Reset ts is forbidden."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /admin/reset-ts [post]
func (h *adminHandler) ResetTS(w http.ResponseWriter, r *http.Request) {
handler := h.svr.GetHandler()
var input map[string]interface{}
Expand Down
34 changes: 17 additions & 17 deletions server/api/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ func newCheckerHandler(svr *server.Server, r *render.Render) *checkerHandler {
}

// FIXME: details of input json body params
// @Tags checker
// @Summary Pause or resume region merge.
// @Accept json
// @Param name path string true "The name of the checker."
// @Param body body object true "json params"
// @Produce json
// @Success 200 {string} string "Pause or resume the scheduler successfully."
// @Failure 400 {string} string "Bad format request."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /checker/{name} [post]
// @Tags checker
// @Summary Pause or resume region merge.
// @Accept json
// @Param name path string true "The name of the checker."
// @Param body body object true "json params"
// @Produce json
// @Success 200 {string} string "Pause or resume the scheduler successfully."
// @Failure 400 {string} string "Bad format request."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /checker/{name} [post]
func (c *checkerHandler) PauseOrResumeChecker(w http.ResponseWriter, r *http.Request) {
var input map[string]int
if err := apiutil.ReadJSONRespondError(c.r, w, r.Body, &input); err != nil {
Expand Down Expand Up @@ -74,13 +74,13 @@ func (c *checkerHandler) PauseOrResumeChecker(w http.ResponseWriter, r *http.Req
}

// FIXME: details of input json body params
// @Tags checker
// @Summary Get if checker is paused
// @Param name path string true "The name of the scheduler."
// @Produce json
// @Success 200 {string} string "Pause or resume the scheduler successfully."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /checker/{name} [get]
// @Tags checker
// @Summary Get if checker is paused
// @Param name path string true "The name of the scheduler."
// @Produce json
// @Success 200 {string} string "Pause or resume the scheduler successfully."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /checker/{name} [get]
func (c *checkerHandler) GetCheckerStatus(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"]
isPaused, err := c.IsCheckerPaused(name)
Expand Down
22 changes: 11 additions & 11 deletions server/api/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ func newClusterHandler(svr *server.Server, rd *render.Render) *clusterHandler {
}
}

// @Tags cluster
// @Summary Get cluster info.
// @Produce json
// @Success 200 {object} metapb.Cluster
// @Router /cluster [get]
// @Tags cluster
// @Summary Get cluster info.
// @Produce json
// @Success 200 {object} metapb.Cluster
// @Router /cluster [get]
func (h *clusterHandler) GetCluster(w http.ResponseWriter, r *http.Request) {
h.rd.JSON(w, http.StatusOK, h.svr.GetCluster())
}

// @Tags cluster
// @Summary Get cluster status.
// @Produce json
// @Success 200 {object} cluster.Status
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /cluster/status [get]
// @Tags cluster
// @Summary Get cluster status.
// @Produce json
// @Success 200 {object} cluster.Status
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /cluster/status [get]
func (h *clusterHandler) GetClusterStatus(w http.ResponseWriter, r *http.Request) {
status, err := h.svr.GetClusterStatus()
if err != nil {
Expand Down
Loading

0 comments on commit 419bc7a

Please sign in to comment.