summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2018-10-21 04:40:42 +0100
committertechknowlogick <hello@techknowlogick.com>2018-10-20 23:40:42 -0400
commit43f92339146224872383d2507ac9487f4857536b (patch)
tree22ec9ebc82074a241e116feb7301c09422db099f /routers/api/v1/repo
parent9b2fcadeef75d9e6256c0258d39751da71847d66 (diff)
downloadgitea-43f92339146224872383d2507ac9487f4857536b.tar.gz
gitea-43f92339146224872383d2507ac9487f4857536b.zip
Fix Swagger JSON autogeneration issues. (#4845)
* Fix Swagger JSON. Remove unnecessary schema references for the forbidden and empty responses Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix swagger API for CreateAccessToken * Fix admin create org swagger * Fix swagger for adminCreateRepo * More swagger fixes Set int64 format for those which are int64 Some more form fixes * Fix swagger description of GET /repos/{owner}/{repo}/pulls
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/hook.go4
-rw-r--r--routers/api/v1/repo/issue.go7
-rw-r--r--routers/api/v1/repo/issue_comment.go6
-rw-r--r--routers/api/v1/repo/issue_label.go6
-rw-r--r--routers/api/v1/repo/issue_tracked_time.go2
-rw-r--r--routers/api/v1/repo/key.go2
-rw-r--r--routers/api/v1/repo/label.go3
-rw-r--r--routers/api/v1/repo/milestone.go3
-rw-r--r--routers/api/v1/repo/pull.go35
-rw-r--r--routers/api/v1/repo/release.go3
-rw-r--r--routers/api/v1/repo/release_attachment.go8
-rw-r--r--routers/api/v1/repo/repo.go2
12 files changed, 73 insertions, 8 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 1f121dfc38..369603694f 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -69,6 +69,7 @@ func GetHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -104,6 +105,7 @@ func TestHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to test
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
@@ -193,6 +195,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
// in: path
// description: index of the hook
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -227,6 +230,7 @@ func DeleteHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 4b634c9ca6..cd78135a62 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -123,6 +123,7 @@ func GetIssue(ctx *context.APIContext) {
// in: path
// description: index of the issue to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -254,6 +255,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
// in: path
// description: index of the issue to edit
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -377,6 +379,7 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
// in: path
// description: index of the issue to create or update a deadline on
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -387,12 +390,8 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
// "$ref": "#/responses/IssueDeadline"
// "403":
// description: Not repo writer
- // schema:
- // "$ref": "#/responses/forbidden"
// "404":
// description: Issue not found
- // schema:
- // "$ref": "#/responses/empty"
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index f958922914..3af0290585 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -36,6 +36,7 @@ func ListIssueComments(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// - name: since
// in: query
@@ -144,6 +145,7 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -193,6 +195,7 @@ func EditIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
// in: path
// description: id of the comment to edit
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -234,6 +237,7 @@ func EditIssueCommentDeprecated(ctx *context.APIContext, form api.EditIssueComme
// in: path
// description: id of the comment to edit
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -293,6 +297,7 @@ func DeleteIssueComment(ctx *context.APIContext) {
// in: path
// description: id of comment to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
@@ -326,6 +331,7 @@ func DeleteIssueCommentDeprecated(ctx *context.APIContext) {
// in: path
// description: id of comment to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/issue_label.go b/routers/api/v1/repo/issue_label.go
index 3657f02c65..35defa25b5 100644
--- a/routers/api/v1/repo/issue_label.go
+++ b/routers/api/v1/repo/issue_label.go
@@ -33,6 +33,7 @@ func ListIssueLabels(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -80,6 +81,7 @@ func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -149,11 +151,13 @@ func DeleteIssueLabel(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// - name: id
// in: path
// description: id of the label to remove
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
@@ -215,6 +219,7 @@ func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -284,6 +289,7 @@ func ClearIssueLabels(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/issue_tracked_time.go b/routers/api/v1/repo/issue_tracked_time.go
index 9be9fee91a..6c29b11b4b 100644
--- a/routers/api/v1/repo/issue_tracked_time.go
+++ b/routers/api/v1/repo/issue_tracked_time.go
@@ -41,6 +41,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -92,6 +93,7 @@ func AddTime(ctx *context.APIContext, form api.AddTimeOption) {
// in: path
// description: index of the issue to add tracked time to
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
diff --git a/routers/api/v1/repo/key.go b/routers/api/v1/repo/key.go
index 1e3666ed42..89a550cfd3 100644
--- a/routers/api/v1/repo/key.go
+++ b/routers/api/v1/repo/key.go
@@ -81,6 +81,7 @@ func GetDeployKey(ctx *context.APIContext) {
// in: path
// description: id of the key to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -191,6 +192,7 @@ func DeleteDeploykey(ctx *context.APIContext) {
// in: path
// description: id of the key to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/label.go b/routers/api/v1/repo/label.go
index 77392787ef..359ccf0e41 100644
--- a/routers/api/v1/repo/label.go
+++ b/routers/api/v1/repo/label.go
@@ -69,6 +69,7 @@ func GetLabel(ctx *context.APIContext) {
// in: path
// description: id of the label to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -163,6 +164,7 @@ func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
// in: path
// description: id of the label to edit
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -219,6 +221,7 @@ func DeleteLabel(ctx *context.APIContext) {
// in: path
// description: id of the label to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go
index a138cb7a69..c621536ad7 100644
--- a/routers/api/v1/repo/milestone.go
+++ b/routers/api/v1/repo/milestone.go
@@ -70,6 +70,7 @@ func GetMilestone(ctx *context.APIContext) {
// in: path
// description: id of the milestone
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -156,6 +157,7 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) {
// in: path
// description: id of the milestone
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -211,6 +213,7 @@ func DeleteMilestone(ctx *context.APIContext) {
// in: path
// description: id of the milestone to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 0ec2d36871..5ce6f868bc 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -38,6 +38,33 @@ func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions)
// description: name of the repo
// type: string
// required: true
+ // - name: page
+ // in: query
+ // description: Page number
+ // type: integer
+ // - name: state
+ // in: query
+ // description: "State of pull request: open or closed (optional)"
+ // type: string
+ // enum: [closed, open, all]
+ // - name: sort
+ // in: query
+ // description: "Type of sort"
+ // type: string
+ // enum: [oldest, recentupdate, leastupdate, mostcomment, leastcomment, priority]
+ // - name: milestone
+ // in: query
+ // description: "ID of the milestone"
+ // type: integer
+ // format: int64
+ // - name: labels
+ // in: query
+ // description: "Label IDs"
+ // type: array
+ // collectionFormat: multi
+ // items:
+ // type: integer
+ // format: int64
// responses:
// "200":
// "$ref": "#/responses/PullRequestList"
@@ -101,6 +128,7 @@ func GetPullRequest(ctx *context.APIContext) {
// in: path
// description: index of the pull request to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -301,6 +329,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
// in: path
// description: index of the pull request to edit
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -430,16 +459,13 @@ func IsPullRequestMerged(ctx *context.APIContext) {
// in: path
// description: index of the pull request
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
// description: pull request has been merged
- // schema:
- // "$ref": "#/responses/empty"
// "404":
// description: pull request has not been merged
- // schema:
- // "$ref": "#/responses/empty"
pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
if models.IsErrPullRequestNotExist(err) {
@@ -478,6 +504,7 @@ func MergePullRequest(ctx *context.APIContext, form auth.MergePullRequestForm) {
// in: path
// description: index of the pull request to merge
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go
index 7c3de3581b..282ff582c5 100644
--- a/routers/api/v1/repo/release.go
+++ b/routers/api/v1/repo/release.go
@@ -33,6 +33,7 @@ func GetRelease(ctx *context.APIContext) {
// in: path
// description: id of the release to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -199,6 +200,7 @@ func EditRelease(ctx *context.APIContext, form api.EditReleaseOption) {
// in: path
// description: id of the release to edit
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -278,6 +280,7 @@ func DeleteRelease(ctx *context.APIContext) {
// in: path
// description: id of the release to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/release_attachment.go b/routers/api/v1/repo/release_attachment.go
index f11fac1629..ea2be719f3 100644
--- a/routers/api/v1/repo/release_attachment.go
+++ b/routers/api/v1/repo/release_attachment.go
@@ -38,11 +38,13 @@ func GetReleaseAttachment(ctx *context.APIContext) {
// in: path
// description: id of the release
// type: integer
+ // format: int64
// required: true
// - name: attachment_id
// in: path
// description: id of the attachment to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -84,6 +86,7 @@ func ListReleaseAttachments(ctx *context.APIContext) {
// in: path
// description: id of the release
// type: integer
+ // format: int64
// required: true
// responses:
// "200":
@@ -129,6 +132,7 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
// in: path
// description: id of the release
// type: integer
+ // format: int64
// required: true
// - name: name
// in: query
@@ -233,11 +237,13 @@ func EditReleaseAttachment(ctx *context.APIContext, form api.EditAttachmentOptio
// in: path
// description: id of the release
// type: integer
+ // format: int64
// required: true
// - name: attachment_id
// in: path
// description: id of the attachment to edit
// type: integer
+ // format: int64
// required: true
// - name: body
// in: body
@@ -292,11 +298,13 @@ func DeleteReleaseAttachment(ctx *context.APIContext) {
// in: path
// description: id of the release
// type: integer
+ // format: int64
// required: true
// - name: attachment_id
// in: path
// description: id of the attachment to delete
// type: integer
+ // format: int64
// required: true
// responses:
// "204":
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index e48b100af6..bf6346eebd 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -53,6 +53,7 @@ func Search(ctx *context.APIContext) {
// in: query
// description: search only for repos that the user with the given id owns or contributes to
// type: integer
+ // format: int64
// - name: page
// in: query
// description: page number of results to return (1-based)
@@ -453,6 +454,7 @@ func GetByID(ctx *context.APIContext) {
// in: path
// description: id of the repo to get
// type: integer
+ // format: int64
// required: true
// responses:
// "200":