-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix missing response types in Swagger API endpoints #7611
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import ( | |
// @Summary Get tool status | ||
// @Accept json | ||
// @Param request body request.HostToolReq true "request" | ||
// @Success 200 | ||
// @Success 200 {object} response.HostToolRes | ||
// @Security ApiKeyAuth | ||
// @Security Timestamp | ||
// @Router /host/tool [post] | ||
|
@@ -77,7 +77,7 @@ func (b *BaseApi) OperateTool(c *gin.Context) { | |
// @Summary Get tool config | ||
// @Accept json | ||
// @Param request body request.HostToolConfig true "request" | ||
// @Success 200 | ||
// @Success 200 {object} response.HostToolConfig | ||
// @Security ApiKeyAuth | ||
// @Security Timestamp | ||
// @Router /host/tool/config [post] | ||
|
@@ -100,7 +100,7 @@ func (b *BaseApi) OperateToolConfig(c *gin.Context) { | |
// @Summary Get tool logs | ||
// @Accept json | ||
// @Param request body request.HostToolLogReq true "request" | ||
// @Success 200 | ||
// @Success 200 {string} logContent | ||
// @Security ApiKeyAuth | ||
// @Security Timestamp | ||
// @Router /host/tool/log [post] | ||
|
@@ -144,7 +144,7 @@ func (b *BaseApi) OperateProcess(c *gin.Context) { | |
// @Tags Host tool | ||
// @Summary Get Supervisor process config | ||
// @Accept json | ||
// @Success 200 | ||
// @Success 200 {object} response.SupervisorProcessConfig | ||
// @Security ApiKeyAuth | ||
// @Security Timestamp | ||
// @Router /host/tool/supervisor/process [get] | ||
|
@@ -161,7 +161,7 @@ func (b *BaseApi) GetProcess(c *gin.Context) { | |
// @Summary Get Supervisor process config | ||
// @Accept json | ||
// @Param request body request.SupervisorProcessFileReq true "request" | ||
// @Success 200 | ||
// @Success 200 {string} content | ||
// @Security ApiKeyAuth | ||
// @Security Timestamp | ||
// @Router /host/tool/supervisor/process/file [post] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no irregularities or significant issues with this Go/Gin API code snippet based on the provided knowledge cutoff of September 1, 2021. However, here are some minor observations:
// @Summary Get Supervisor process config
// @Desc Retrieve the configuration details for Supervisor processes. This change ensures clarity about what this endpoint actually accomplishes.
These points, while not breaking any fundamental aspects of the code, could improve readability, consistency, and maintainability. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ListFiles
function should be changed to use a struct literal instead of casting.2.
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
can be simplified tohelper.FailWithDetail(c, "internal server error", err)
The change from using
constant.ErrTypeInternalServer
to just stating"internal server error"
is more explicit and cleaner.In the
Keys
function, if there are multiple keys that need to be returned, it might be better to have those values stored in an array or map before passing them toSuccessWithData
.In summary, these changes streamline some boilerplate code such as logging errors or formatting responses and make them easier to read and maintain.