Skip to content

Commit

Permalink
Fix swagger errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ish-hcc committed Aug 29, 2024
1 parent 4199197 commit b95b859
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 98 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ stop_docker: stop_airflow ## Stop the Docker containers
clean: ## Remove previous build
@echo Cleaning build...
@rm -f coverage.out
@rm -f pkg/api/rest/docs/docs.go pkg/api/rest/docs/swagger.*
@rm -rf cmd/${MODULE_NAME}/conf
@cd cmd/${MODULE_NAME} && ${GO_COMMAND} clean

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/rest/controller/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var IsReady = false
// @Success 200 {object} model.SimpleMsg "Successfully get ready state."
// @Failure 500 {object} common.ErrorResponse "Failed to check ready state."
//
// @Router /cicada/readyz [get]
// @Router /readyz [get]
func CheckReady(c echo.Context) error {
status := http.StatusOK

Expand Down
12 changes: 6 additions & 6 deletions pkg/api/rest/controller/taskComponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// @Success 200 {object} model.TaskComponent "Successfully register the task component"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to register the task component"
// @Router /cicada/task_component [post]
// @Router /task_component [post]
func CreateTaskComponent(c echo.Context) error {
createTaskComponentReq := new(model.CreateTaskComponentReq)
err := c.Bind(createTaskComponentReq)
Expand Down Expand Up @@ -57,7 +57,7 @@ func CreateTaskComponent(c echo.Context) error {
// @Success 200 {object} model.TaskComponent "Successfully get the task component"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the task component"
// @Router /cicada/task_component/{tcId} [get]
// @Router /task_component/{tcId} [get]
func GetTaskComponent(c echo.Context) error {
tcId := c.Param("tcId")
if tcId == "" {
Expand All @@ -81,7 +81,7 @@ func GetTaskComponent(c echo.Context) error {
// @Success 200 {object} model.TaskComponent "Successfully get the task component"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the task component"
// @Router /cicada/task_component/name/{tcName} [get]
// @Router /task_component/name/{tcName} [get]
func GetTaskComponentByName(c echo.Context) error {
tcName := c.Param("tcName")
if tcName == "" {
Expand All @@ -106,7 +106,7 @@ func GetTaskComponentByName(c echo.Context) error {
// @Success 200 {object} []model.TaskComponent "Successfully get a list of task component."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get a list of task component."
// @Router /cicada/task_component [get]
// @Router /task_component [get]
func ListTaskComponent(c echo.Context) error {
page, row, err := common.CheckPageRow(c)
if err != nil {
Expand All @@ -132,7 +132,7 @@ func ListTaskComponent(c echo.Context) error {
// @Success 200 {object} model.TaskComponent "Successfully update the task component"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to update the task component"
// @Router /cicada/task_component/{tcId} [put]
// @Router /task_component/{tcId} [put]
func UpdateTaskComponent(c echo.Context) error {
taskComponent := new(model.CreateTaskComponentReq)
err := c.Bind(taskComponent)
Expand Down Expand Up @@ -174,7 +174,7 @@ func UpdateTaskComponent(c echo.Context) error {
// @Success 200 {object} model.SimpleMsg "Successfully delete the task component"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to delete the task component"
// @Router /cicada/task_component/{tcId} [delete]
// @Router /task_component/{tcId} [delete]
func DeleteTaskComponent(c echo.Context) error {
tcId := c.Param("tcId")
if tcId == "" {
Expand Down
32 changes: 16 additions & 16 deletions pkg/api/rest/controller/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func createDataReqToData(createDataReq model.CreateDataReq) (model.Data, error)
// @Success 200 {object} model.WorkflowTemplate "Successfully create the workflow."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to create workflow."
// @Router /cicada/workflow [post]
// @Router /workflow [post]
func CreateWorkflow(c echo.Context) error {
var createWorkflowReq model.CreateWorkflowReq

Expand Down Expand Up @@ -192,7 +192,7 @@ func CreateWorkflow(c echo.Context) error {
// @Success 200 {object} model.Workflow "Successfully get the workflow."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow."
// @Router /cicada/workflow/{wfId} [get]
// @Router /workflow/{wfId} [get]
func GetWorkflow(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -241,7 +241,7 @@ func GetWorkflow(c echo.Context) error {
// @Success 200 {object} model.Workflow "Successfully get the workflow."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow."
// @Router /cicada/workflow/name/{wfName} [get]
// @Router /workflow/name/{wfName} [get]
func GetWorkflowByName(c echo.Context) error {
wfName := c.Param("wfName")
if wfName == "" {
Expand Down Expand Up @@ -286,13 +286,13 @@ func GetWorkflowByName(c echo.Context) error {
// @Tags [Workflow]
// @Accept json
// @Produce json
// @Param name path string false "Name of the workflow"
// @Param name query string false "Name of the workflow"
// @Param page query string false "Page of the workflow list."
// @Param row query string false "Row of the workflow list."
// @Success 200 {object} []model.Workflow "Successfully get a workflow list."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get a workflow list."
// @Router /cicada/workflow [get]
// @Router /workflow [get]
func ListWorkflow(c echo.Context) error {
page, row, err := common.CheckPageRow(c)
if err != nil {
Expand Down Expand Up @@ -342,7 +342,7 @@ func ListWorkflow(c echo.Context) error {
// @Success 200 {object} model.SimpleMsg "Successfully run the workflow."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to run the Workflow"
// @Router /cicada/workflow/{wfId}/run [post]
// @Router /workflow/{wfId}/run [post]
func RunWorkflow(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -374,7 +374,7 @@ func RunWorkflow(c echo.Context) error {
// @Success 200 {object} model.Workflow "Successfully update the workflow"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to update the workflow"
// @Router /cicada/workflow/{wfId} [put]
// @Router /workflow/{wfId} [put]
func UpdateWorkflow(c echo.Context) error {
var updateWorkflowReq model.CreateWorkflowReq

Expand Down Expand Up @@ -491,7 +491,7 @@ func UpdateWorkflow(c echo.Context) error {
// @Success 200 {object} model.SimpleMsg "Successfully delete the workflow"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to delete the workflow"
// @Router /cicada/workflow/{wfId} [delete]
// @Router /workflow/{wfId} [delete]
func DeleteWorkflow(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -549,7 +549,7 @@ func DeleteWorkflow(c echo.Context) error {
// @Success 200 {object} []model.TaskGroup "Successfully get a task group list."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get a task group list."
// @Router /cicada/workflow/{wfId}/task_group [get]
// @Router /workflow/{wfId}/task_group [get]
func ListTaskGroup(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -579,7 +579,7 @@ func ListTaskGroup(c echo.Context) error {
// @Success 200 {object} model.Task "Successfully get the task group."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the task group."
// @Router /cicada/workflow/{wfId}/task_group/{tgId} [get]
// @Router /workflow/{wfId}/task_group/{tgId} [get]
func GetTaskGroup(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -616,7 +616,7 @@ func GetTaskGroup(c echo.Context) error {
// @Success 200 {object} model.Task "Successfully get the task group."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the task group."
// @Router /cicada/task_group/{tgId} [get]
// @Router /task_group/{tgId} [get]
func GetTaskGroupDirectly(c echo.Context) error {
tgId := c.Param("tgId")
if tgId == "" {
Expand Down Expand Up @@ -660,7 +660,7 @@ func GetTaskGroupDirectly(c echo.Context) error {
// @Success 200 {object} []model.Task "Successfully get a task list from the task group."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get a task list from the task group."
// @Router /cicada/workflow/{wfId}/task_group/{tgId}/task [get]
// @Router /workflow/{wfId}/task_group/{tgId}/task [get]
func ListTaskFromTaskGroup(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -701,7 +701,7 @@ func ListTaskFromTaskGroup(c echo.Context) error {
// @Success 200 {object} model.Task "Successfully get the task from the task group."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the task from the task group."
// @Router /cicada/workflow/{wfId}/task_group/{tgId}/task/{taskId} [get]
// @Router /workflow/{wfId}/task_group/{tgId}/task/{taskId} [get]
func GetTaskFromTaskGroup(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -749,7 +749,7 @@ func GetTaskFromTaskGroup(c echo.Context) error {
// @Success 200 {object} []model.Task "Successfully get a task list."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get a task list."
// @Router /cicada/workflow/{wfId}/task [get]
// @Router /workflow/{wfId}/task [get]
func ListTask(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -781,7 +781,7 @@ func ListTask(c echo.Context) error {
// @Success 200 {object} model.Task "Successfully get the task."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the task."
// @Router /cicada/workflow/{wfId}/task/{taskId} [get]
// @Router /workflow/{wfId}/task/{taskId} [get]
func GetTask(c echo.Context) error {
wfId := c.Param("wfId")
if wfId == "" {
Expand Down Expand Up @@ -820,7 +820,7 @@ func GetTask(c echo.Context) error {
// @Success 200 {object} model.TaskDirectly "Successfully get the task."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the task."
// @Router /cicada/task/{taskId} [get]
// @Router /task/{taskId} [get]
func GetTaskDirectly(c echo.Context) error {
taskId := c.Param("taskId")
if taskId == "" {
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/rest/controller/workflowTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// @Success 200 {object} model.GetWorkflowTemplate "Successfully get the workflow template"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow template"
// @Router /cicada/workflow_template/{wftId} [get]
// @Router /workflow_template/{wftId} [get]
func GetWorkflowTemplate(c echo.Context) error {
wftId := c.Param("wftId")
if wftId == "" {
Expand All @@ -45,7 +45,7 @@ func GetWorkflowTemplate(c echo.Context) error {
// @Success 200 {object} model.GetWorkflowTemplate "Successfully get the workflow template"
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get the workflow template"
// @Router /cicada/workflow_template/name/{wfName} [get]
// @Router /workflow_template/name/{wfName} [get]
func GetWorkflowTemplateByName(c echo.Context) error {
wfName := c.Param("wfName")
if wfName == "" {
Expand All @@ -68,13 +68,13 @@ func GetWorkflowTemplateByName(c echo.Context) error {
// @Tags [Workflow Template]
// @Accept json
// @Produce json
// @Param name path string false "Name of the workflow template"
// @Param name query string false "Name of the workflow template"
// @Param page query string false "Page of the workflow template list."
// @Param row query string false "Row of the workflow template list."
// @Success 200 {object} []model.WorkflowTemplate "Successfully get a list of workflow template."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get a list of workflow template."
// @Router /cicada/workflow_template [get]
// @Router /workflow_template [get]
func ListWorkflowTemplate(c echo.Context) error {
page, row, err := common.CheckPageRow(c)
if err != nil {
Expand Down
Loading

0 comments on commit b95b859

Please sign in to comment.