From 053f9186bcfe1b0d6beb05c0615f95afd77729ba Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Wed, 9 Jul 2025 18:18:40 +0200 Subject: [PATCH] Fix the response format for `actions/workflows`. (#35009) (#35016) Backport #35009 This PR fixes the response format for the OpenAPI Spec of `ActionsListRepositoryWorkflows`. It was specified in the OpenAPI spec as returning a `[]*ActionWorkflow`, but it actually should return a `api.ActionWorkflowResponse`. The test already expects an `api.ActionWorkflowResponse` like expected. Co-authored-by: Scion --- routers/api/v1/swagger/action.go | 2 +- templates/swagger/v1_json.tmpl | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/routers/api/v1/swagger/action.go b/routers/api/v1/swagger/action.go index 16a250184a..0606505950 100644 --- a/routers/api/v1/swagger/action.go +++ b/routers/api/v1/swagger/action.go @@ -44,5 +44,5 @@ type swaggerResponseActionWorkflow struct { // swagger:response ActionWorkflowList type swaggerResponseActionWorkflowList struct { // in:body - Body []api.ActionWorkflow `json:"body"` + Body api.ActionWorkflowResponse `json:"body"` } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 535982779d..3615edf771 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -20327,6 +20327,25 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ActionWorkflowResponse": { + "description": "ActionWorkflowResponse returns a ActionWorkflow", + "type": "object", + "properties": { + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + }, + "workflows": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflow" + }, + "x-go-name": "Workflows" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "ActionWorkflowRun": { "description": "ActionWorkflowRun represents a WorkflowRun", "type": "object", @@ -27464,10 +27483,7 @@ "ActionWorkflowList": { "description": "ActionWorkflowList", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ActionWorkflow" - } + "$ref": "#/definitions/ActionWorkflowResponse" } }, "ActivityFeedsList": {