Skip to content

Commit dfd27c1

Browse files
committed
fix swagger consistency
1 parent f82178e commit dfd27c1

File tree

6 files changed

+232
-16
lines changed

6 files changed

+232
-16
lines changed

modules/structs/repo_actions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ type ActionWorkflowRun struct {
107107
CompletedAt time.Time `json:"completed_at,omitempty"`
108108
}
109109

110-
// ActionArtifactsResponse returns ActionArtifacts
110+
// ActionWorkflowRunsResponse returns ActionWorkflowRuns
111111
type ActionWorkflowRunsResponse struct {
112112
Entries []*ActionWorkflowRun `json:"workflow_runs"`
113113
TotalCount int64 `json:"total_count"`
114114
}
115115

116-
// ActionArtifactsResponse returns ActionArtifacts
116+
// ActionWorkflowJobsResponse returns ActionWorkflowJobs
117117
type ActionWorkflowJobsResponse struct {
118118
Entries []*ActionWorkflowJob `json:"jobs"`
119119
TotalCount int64 `json:"total_count"`

routers/api/v1/admin/runners.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func ListWorkflowJobs(ctx *context.APIContext) {
112112
// - application/json
113113
// responses:
114114
// "200":
115-
// "$ref": "#/responses/JobList"
115+
// "$ref": "#/responses/WorkflowJobsList"
116116
// "400":
117117
// "$ref": "#/responses/error"
118118
// "404":
@@ -130,7 +130,7 @@ func ListWorkflowRuns(ctx *context.APIContext) {
130130
// - application/json
131131
// responses:
132132
// "200":
133-
// "$ref": "#/responses/RunList"
133+
// "$ref": "#/responses/WorkflowRunsList"
134134
// "400":
135135
// "$ref": "#/responses/error"
136136
// "404":

routers/api/v1/repo/action.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ func (Action) ListWorkflowJobs(ctx *context.APIContext) {
670670
// required: true
671671
// responses:
672672
// "200":
673-
// "$ref": "#/responses/JobList"
673+
// "$ref": "#/responses/WorkflowJobsList"
674674
// "400":
675675
// "$ref": "#/responses/error"
676676
// "404":
@@ -1094,7 +1094,7 @@ func GetWorkflowRun(ctx *context.APIContext) {
10941094
// required: true
10951095
// responses:
10961096
// "200":
1097-
// "$ref": "#/responses/Artifact"
1097+
// "$ref": "#/responses/WorkflowRun"
10981098
// "400":
10991099
// "$ref": "#/responses/error"
11001100
// "404":
@@ -1140,7 +1140,7 @@ func ListWorkflowRunJobs(ctx *context.APIContext) {
11401140
// required: true
11411141
// responses:
11421142
// "200":
1143-
// "$ref": "#/responses/JobList"
1143+
// "$ref": "#/responses/WorkflowJobsList"
11441144
// "400":
11451145
// "$ref": "#/responses/error"
11461146
// "404":
@@ -1178,7 +1178,7 @@ func GetWorkflowJob(ctx *context.APIContext) {
11781178
// required: true
11791179
// responses:
11801180
// "200":
1181-
// "$ref": "#/responses/Job"
1181+
// "$ref": "#/responses/WorkflowJob"
11821182
// "400":
11831183
// "$ref": "#/responses/error"
11841184
// "404":

routers/api/v1/swagger/repo.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,34 @@ type swaggerRepoTasksList struct {
443443
Body api.ActionTaskResponse `json:"body"`
444444
}
445445

446+
// WorkflowRunsList
447+
// swagger:response WorkflowRunsList
448+
type swaggerActionWorkflowRunsResponse struct {
449+
// in:body
450+
Body api.ActionWorkflowRunsResponse `json:"body"`
451+
}
452+
453+
// WorkflowRun
454+
// swagger:response WorkflowRun
455+
type swaggerWorkflowRun struct {
456+
// in:body
457+
Body api.ActionWorkflowRun `json:"body"`
458+
}
459+
460+
// WorkflowJobsList
461+
// swagger:response WorkflowJobsList
462+
type swaggerActionWorkflowJobsResponse struct {
463+
// in:body
464+
Body api.ActionWorkflowJobsResponse `json:"body"`
465+
}
466+
467+
// WorkflowJob
468+
// swagger:response WorkflowJob
469+
type swaggerWorkflowJob struct {
470+
// in:body
471+
Body api.ActionWorkflowJob `json:"body"`
472+
}
473+
446474
// ArtifactsList
447475
// swagger:response ArtifactsList
448476
type swaggerRepoArtifactsList struct {

routers/api/v1/user/runners.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,6 @@ func ListWorkflowJobs(ctx *context.APIContext) {
125125
// - application/json
126126
// responses:
127127
// "200":
128-
// "$ref": "#/responses/ActionWorkflowJobsResponse"
128+
// "$ref": "#/responses/WorkflowJobsList"
129129
shared.ListJobs(ctx, ctx.Doer.ID, 0, 0)
130130
}

templates/swagger/v1_json.tmpl

Lines changed: 195 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)