0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-21 12:24:38 +02:00

fix swagger consistency

This commit is contained in:
Christopher Homberger 2025-05-03 13:42:36 +02:00
parent f82178edb3
commit dfd27c1b60
6 changed files with 232 additions and 16 deletions

View File

@ -107,13 +107,13 @@ type ActionWorkflowRun struct {
CompletedAt time.Time `json:"completed_at,omitempty"`
}
// ActionArtifactsResponse returns ActionArtifacts
// ActionWorkflowRunsResponse returns ActionWorkflowRuns
type ActionWorkflowRunsResponse struct {
Entries []*ActionWorkflowRun `json:"workflow_runs"`
TotalCount int64 `json:"total_count"`
}
// ActionArtifactsResponse returns ActionArtifacts
// ActionWorkflowJobsResponse returns ActionWorkflowJobs
type ActionWorkflowJobsResponse struct {
Entries []*ActionWorkflowJob `json:"jobs"`
TotalCount int64 `json:"total_count"`

View File

@ -112,7 +112,7 @@ func ListWorkflowJobs(ctx *context.APIContext) {
// - application/json
// responses:
// "200":
// "$ref": "#/responses/JobList"
// "$ref": "#/responses/WorkflowJobsList"
// "400":
// "$ref": "#/responses/error"
// "404":
@ -130,7 +130,7 @@ func ListWorkflowRuns(ctx *context.APIContext) {
// - application/json
// responses:
// "200":
// "$ref": "#/responses/RunList"
// "$ref": "#/responses/WorkflowRunsList"
// "400":
// "$ref": "#/responses/error"
// "404":

View File

@ -670,7 +670,7 @@ func (Action) ListWorkflowJobs(ctx *context.APIContext) {
// required: true
// responses:
// "200":
// "$ref": "#/responses/JobList"
// "$ref": "#/responses/WorkflowJobsList"
// "400":
// "$ref": "#/responses/error"
// "404":
@ -1094,7 +1094,7 @@ func GetWorkflowRun(ctx *context.APIContext) {
// required: true
// responses:
// "200":
// "$ref": "#/responses/Artifact"
// "$ref": "#/responses/WorkflowRun"
// "400":
// "$ref": "#/responses/error"
// "404":
@ -1140,7 +1140,7 @@ func ListWorkflowRunJobs(ctx *context.APIContext) {
// required: true
// responses:
// "200":
// "$ref": "#/responses/JobList"
// "$ref": "#/responses/WorkflowJobsList"
// "400":
// "$ref": "#/responses/error"
// "404":
@ -1178,7 +1178,7 @@ func GetWorkflowJob(ctx *context.APIContext) {
// required: true
// responses:
// "200":
// "$ref": "#/responses/Job"
// "$ref": "#/responses/WorkflowJob"
// "400":
// "$ref": "#/responses/error"
// "404":

View File

@ -443,6 +443,34 @@ type swaggerRepoTasksList struct {
Body api.ActionTaskResponse `json:"body"`
}
// WorkflowRunsList
// swagger:response WorkflowRunsList
type swaggerActionWorkflowRunsResponse struct {
// in:body
Body api.ActionWorkflowRunsResponse `json:"body"`
}
// WorkflowRun
// swagger:response WorkflowRun
type swaggerWorkflowRun struct {
// in:body
Body api.ActionWorkflowRun `json:"body"`
}
// WorkflowJobsList
// swagger:response WorkflowJobsList
type swaggerActionWorkflowJobsResponse struct {
// in:body
Body api.ActionWorkflowJobsResponse `json:"body"`
}
// WorkflowJob
// swagger:response WorkflowJob
type swaggerWorkflowJob struct {
// in:body
Body api.ActionWorkflowJob `json:"body"`
}
// ArtifactsList
// swagger:response ArtifactsList
type swaggerRepoArtifactsList struct {

View File

@ -125,6 +125,6 @@ func ListWorkflowJobs(ctx *context.APIContext) {
// - application/json
// responses:
// "200":
// "$ref": "#/responses/ActionWorkflowJobsResponse"
// "$ref": "#/responses/WorkflowJobsList"
shared.ListJobs(ctx, ctx.Doer.ID, 0, 0)
}

View File

@ -87,7 +87,7 @@
"operationId": "listAdminWorkflowJobs",
"responses": {
"200": {
"$ref": "#/responses/JobList"
"$ref": "#/responses/WorkflowJobsList"
},
"400": {
"$ref": "#/responses/error"
@ -212,7 +212,7 @@
"operationId": "listAdminWorkflowRuns",
"responses": {
"200": {
"$ref": "#/responses/RunList"
"$ref": "#/responses/WorkflowRunsList"
},
"400": {
"$ref": "#/responses/error"
@ -4635,7 +4635,7 @@
],
"responses": {
"200": {
"$ref": "#/responses/JobList"
"$ref": "#/responses/WorkflowJobsList"
},
"400": {
"$ref": "#/responses/error"
@ -4681,7 +4681,7 @@
],
"responses": {
"200": {
"$ref": "#/responses/Job"
"$ref": "#/responses/WorkflowJob"
},
"400": {
"$ref": "#/responses/error"
@ -5023,7 +5023,7 @@
],
"responses": {
"200": {
"$ref": "#/responses/Artifact"
"$ref": "#/responses/WorkflowRun"
},
"400": {
"$ref": "#/responses/error"
@ -5121,7 +5121,7 @@
],
"responses": {
"200": {
"$ref": "#/responses/JobList"
"$ref": "#/responses/WorkflowJobsList"
},
"400": {
"$ref": "#/responses/error"
@ -17801,7 +17801,7 @@
"operationId": "getUserWorkflowJobs",
"responses": {
"200": {
"$ref": "#/responses/ActionWorkflowJobsResponse"
"$ref": "#/responses/WorkflowJobsList"
}
}
}
@ -20682,6 +20682,117 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"ActionWorkflowJob": {
"description": "ActionWorkflowJob represents a WorkflowJob",
"type": "object",
"properties": {
"completed_at": {
"type": "string",
"format": "date-time",
"x-go-name": "CompletedAt"
},
"conclusion": {
"type": "string",
"x-go-name": "Conclusion"
},
"created_at": {
"type": "string",
"format": "date-time",
"x-go-name": "CreatedAt"
},
"head_branch": {
"type": "string",
"x-go-name": "HeadBranch"
},
"head_sha": {
"type": "string",
"x-go-name": "HeadSha"
},
"html_url": {
"type": "string",
"x-go-name": "HTMLURL"
},
"id": {
"type": "integer",
"format": "int64",
"x-go-name": "ID"
},
"labels": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "Labels"
},
"name": {
"type": "string",
"x-go-name": "Name"
},
"run_attempt": {
"type": "integer",
"format": "int64",
"x-go-name": "RunAttempt"
},
"run_id": {
"type": "integer",
"format": "int64",
"x-go-name": "RunID"
},
"run_url": {
"type": "string",
"x-go-name": "RunURL"
},
"runner_id": {
"type": "integer",
"format": "int64",
"x-go-name": "RunnerID"
},
"runner_name": {
"type": "string",
"x-go-name": "RunnerName"
},
"started_at": {
"type": "string",
"format": "date-time",
"x-go-name": "StartedAt"
},
"status": {
"type": "string",
"x-go-name": "Status"
},
"steps": {
"type": "array",
"items": {
"$ref": "#/definitions/ActionWorkflowStep"
},
"x-go-name": "Steps"
},
"url": {
"type": "string",
"x-go-name": "URL"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"ActionWorkflowJobsResponse": {
"description": "ActionWorkflowJobsResponse returns ActionWorkflowJobs",
"type": "object",
"properties": {
"jobs": {
"type": "array",
"items": {
"$ref": "#/definitions/ActionWorkflowJob"
},
"x-go-name": "Entries"
},
"total_count": {
"type": "integer",
"format": "int64",
"x-go-name": "TotalCount"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"ActionWorkflowRun": {
"description": "ActionWorkflowRun represents a WorkflowRun",
"type": "object",
@ -20761,6 +20872,59 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"ActionWorkflowRunsResponse": {
"description": "ActionWorkflowRunsResponse returns ActionWorkflowRuns",
"type": "object",
"properties": {
"total_count": {
"type": "integer",
"format": "int64",
"x-go-name": "TotalCount"
},
"workflow_runs": {
"type": "array",
"items": {
"$ref": "#/definitions/ActionWorkflowRun"
},
"x-go-name": "Entries"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"ActionWorkflowStep": {
"description": "ActionWorkflowStep represents a step of a WorkflowJob",
"type": "object",
"properties": {
"completed_at": {
"type": "string",
"format": "date-time",
"x-go-name": "CompletedAt"
},
"conclusion": {
"type": "string",
"x-go-name": "Conclusion"
},
"name": {
"type": "string",
"x-go-name": "Name"
},
"number": {
"type": "integer",
"format": "int64",
"x-go-name": "Number"
},
"started_at": {
"type": "string",
"format": "date-time",
"x-go-name": "StartedAt"
},
"status": {
"type": "string",
"x-go-name": "Status"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"Activity": {
"type": "object",
"properties": {
@ -28873,6 +29037,30 @@
}
}
},
"WorkflowJob": {
"description": "WorkflowJob",
"schema": {
"$ref": "#/definitions/ActionWorkflowJob"
}
},
"WorkflowJobsList": {
"description": "WorkflowJobsList",
"schema": {
"$ref": "#/definitions/ActionWorkflowJobsResponse"
}
},
"WorkflowRun": {
"description": "WorkflowRun",
"schema": {
"$ref": "#/definitions/ActionWorkflowRun"
}
},
"WorkflowRunsList": {
"description": "WorkflowRunsList",
"schema": {
"$ref": "#/definitions/ActionWorkflowRunsResponse"
}
},
"conflict": {
"description": "APIConflict is a conflict empty response"
},