Skip to content

Fix #5799 - swagger for mergePullRequest #5996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/auth/repo_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been without spaces to have correct values in swagger json

Do string `binding:"Required;In(merge,rebase,rebase-merge,squash)"`
MergeTitleField string
MergeMessageField string
Expand Down
4 changes: 4 additions & 0 deletions routers/api/v1/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions routers/api/v1/swagger/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3931,6 +3931,13 @@
"name": "index",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/MergePullRequestOption"
}
}
],
"responses": {
Expand Down Expand Up @@ -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",
Expand Down