From 7fb09f035ac8b10191c154ed4395a8e02d3c5e8d Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Fri, 8 Feb 2019 09:08:38 +0100 Subject: [PATCH] Fix #5799 - swagger for mergePullRequest (#5996) --- modules/auth/repo_form.go | 3 +++ routers/api/v1/repo/pull.go | 4 ++++ routers/api/v1/swagger/options.go | 2 ++ templates/swagger/v1_json.tmpl | 33 +++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index ff64d9a56..3f5078171 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -364,7 +364,10 @@ func (f *InitializeLabelsForm) Validate(ctx *macaron.Context, errs binding.Error // \/ \/ |__| \/ \/ // MergePullRequestForm form for merging Pull Request +// swagger:model MergePullRequestOption type MergePullRequestForm struct { + // required: true + // enum: merge, rebase, rebase-merge, squash Do string `binding:"Required;In(merge,rebase,rebase-merge,squash)"` MergeTitleField string MergeMessageField string diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 64c7e9447..e7c12b903 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -518,6 +518,10 @@ func MergePullRequest(ctx *context.APIContext, form auth.MergePullRequestForm) { // type: integer // format: int64 // required: true + // - name: body + // in: body + // schema: + // $ref: "#/definitions/MergePullRequestOption" // responses: // "200": // "$ref": "#/responses/empty" diff --git a/routers/api/v1/swagger/options.go b/routers/api/v1/swagger/options.go index 177fe415f..5aaee8d6e 100644 --- a/routers/api/v1/swagger/options.go +++ b/routers/api/v1/swagger/options.go @@ -68,6 +68,8 @@ type swaggerParameterBodies struct { CreatePullRequestOption api.CreatePullRequestOption // in:body EditPullRequestOption api.EditPullRequestOption + // in:body + MergePullRequestOption auth.MergePullRequestForm // in:body CreateReleaseOption api.CreateReleaseOption diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 6ecaf861d..d77c5b708 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -3931,6 +3931,13 @@ "name": "index", "in": "path", "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/MergePullRequestOption" + } } ], "responses": { @@ -7700,6 +7707,32 @@ }, "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" }, + "MergePullRequestOption": { + "description": "MergePullRequestForm form for merging Pull Request", + "type": "object", + "required": [ + "Do" + ], + "properties": { + "Do": { + "type": "string", + "enum": [ + "merge", + " rebase", + " rebase-merge", + " squash" + ] + }, + "MergeMessageField": { + "type": "string" + }, + "MergeTitleField": { + "type": "string" + } + }, + "x-go-name": "MergePullRequestForm", + "x-go-package": "code.gitea.io/gitea/modules/auth" + }, "MigrateRepoForm": { "description": "MigrateRepoForm form for migrating repository", "type": "object",