From ea01decb6b6d5b4231001b76f339a5451f813431 Mon Sep 17 00:00:00 2001 From: David Schneiderbauer Date: Tue, 8 May 2018 08:05:18 +0200 Subject: [PATCH] fix wrong issue endpoints in swagger doc (#3914) --- public/swagger.v1.json | 388 +++++++++++++-------------- routers/api/v1/repo/issue_comment.go | 2 +- routers/api/v1/repo/issue_label.go | 8 +- 3 files changed, 197 insertions(+), 201 deletions(-) diff --git a/public/swagger.v1.json b/public/swagger.v1.json index baacdfdf8..c5b1baa9a 100644 --- a/public/swagger.v1.json +++ b/public/swagger.v1.json @@ -1605,7 +1605,7 @@ } } }, - "/repos/{owner}/{repo}/issue/{index}/comments": { + "/repos/{owner}/{repo}/issues": { "get": { "produces": [ "application/json" @@ -1613,8 +1613,8 @@ "tags": [ "issue" ], - "summary": "List all comments on an issue", - "operationId": "issueGetComments", + "summary": "List a repository's issues", + "operationId": "issueListIssues", "parameters": [ { "type": "string", @@ -1630,29 +1630,32 @@ "in": "path", "required": true }, + { + "type": "string", + "description": "whether issue is open or closed", + "name": "state", + "in": "query" + }, { "type": "integer", - "description": "index of the issue", - "name": "id", - "in": "path", - "required": true + "description": "page number of requested issues", + "name": "page", + "in": "query" }, { "type": "string", - "description": "if provided, only comments updated since the specified time are returned.", - "name": "string", + "description": "search string", + "name": "q", "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/CommentList" + "$ref": "#/responses/IssueList" } } - } - }, - "/repos/{owner}/{repo}/issue/{index}/labels": { - "put": { + }, + "post": { "consumes": [ "application/json" ], @@ -1662,8 +1665,8 @@ "tags": [ "issue" ], - "summary": "Replace an issue's labels", - "operationId": "issueReplaceLabels", + "summary": "Create an issue", + "operationId": "issueCreateIssue", "parameters": [ { "type": "string", @@ -1679,39 +1682,31 @@ "in": "path", "required": true }, - { - "type": "integer", - "description": "index of the issue", - "name": "index", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "schema": { - "$ref": "#/definitions/IssueLabelsOption" + "$ref": "#/definitions/CreateIssueOption" } } ], "responses": { - "200": { - "$ref": "#/responses/LabelList" + "201": { + "$ref": "#/responses/Issue" } } - }, - "post": { - "consumes": [ - "application/json" - ], + } + }, + "/repos/{owner}/{repo}/issues/comments": { + "get": { "produces": [ "application/json" ], "tags": [ "issue" ], - "summary": "Add a label to an issue", - "operationId": "issueAddLabel", + "summary": "List all comments in a repository", + "operationId": "issueGetRepoComments", "parameters": [ { "type": "string", @@ -1728,35 +1723,26 @@ "required": true }, { - "type": "integer", - "description": "index of the issue", - "name": "index", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/IssueLabelsOption" - } + "type": "string", + "description": "if provided, only comments updated since the provided time are returned.", + "name": "string", + "in": "query" } ], "responses": { "200": { - "$ref": "#/responses/LabelList" + "$ref": "#/responses/CommentList" } } - }, + } + }, + "/repos/{owner}/{repo}/issues/comments/{id}": { "delete": { - "produces": [ - "application/json" - ], "tags": [ "issue" ], - "summary": "Remove all labels from an issue", - "operationId": "issueClearLabels", + "summary": "Delete a comment", + "operationId": "issueDeleteComment", "parameters": [ { "type": "string", @@ -1774,8 +1760,8 @@ }, { "type": "integer", - "description": "index of the issue", - "name": "index", + "description": "id of comment to delete", + "name": "id", "in": "path", "required": true } @@ -1785,18 +1771,19 @@ "$ref": "#/responses/empty" } } - } - }, - "/repos/{owner}/{repo}/issue/{index}/labels/{id}": { - "delete": { + }, + "patch": { + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ "issue" ], - "summary": "Remove a label from an issue", - "operationId": "issueRemoveLabel", + "summary": "Edit a comment", + "operationId": "issueEditComment", "parameters": [ { "type": "string", @@ -1814,27 +1801,27 @@ }, { "type": "integer", - "description": "index of the issue", - "name": "index", + "description": "id of the comment to edit", + "name": "id", "in": "path", "required": true }, { - "type": "integer", - "description": "id of the label to remove", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditIssueCommentOption" + } } ], "responses": { - "204": { - "$ref": "#/responses/empty" + "200": { + "$ref": "#/responses/Comment" } } } }, - "/repos/{owner}/{repo}/issues": { + "/repos/{owner}/{repo}/issues/{index}": { "get": { "produces": [ "application/json" @@ -1842,8 +1829,8 @@ "tags": [ "issue" ], - "summary": "List a repository's issues", - "operationId": "issueListIssues", + "summary": "Get an issue", + "operationId": "issueGetIssue", "parameters": [ { "type": "string", @@ -1859,32 +1846,21 @@ "in": "path", "required": true }, - { - "type": "string", - "description": "whether issue is open or closed", - "name": "state", - "in": "query" - }, { "type": "integer", - "description": "page number of requested issues", - "name": "page", - "in": "query" - }, - { - "type": "string", - "description": "search string", - "name": "q", - "in": "query" + "description": "index of the issue to get", + "name": "index", + "in": "path", + "required": true } ], "responses": { "200": { - "$ref": "#/responses/IssueList" + "$ref": "#/responses/Issue" } } }, - "post": { + "patch": { "consumes": [ "application/json" ], @@ -1894,8 +1870,8 @@ "tags": [ "issue" ], - "summary": "Create an issue", - "operationId": "issueCreateIssue", + "summary": "Edit an issue", + "operationId": "issueEditIssue", "parameters": [ { "type": "string", @@ -1911,11 +1887,18 @@ "in": "path", "required": true }, + { + "type": "integer", + "description": "index of the issue to edit", + "name": "index", + "in": "path", + "required": true + }, { "name": "body", "in": "body", "schema": { - "$ref": "#/definitions/CreateIssueOption" + "$ref": "#/definitions/EditIssueOption" } } ], @@ -1926,7 +1909,7 @@ } } }, - "/repos/{owner}/{repo}/issues/comments": { + "/repos/{owner}/{repo}/issues/{index}/comments": { "get": { "produces": [ "application/json" @@ -1934,8 +1917,8 @@ "tags": [ "issue" ], - "summary": "List all comments in a repository", - "operationId": "issueGetRepoComments", + "summary": "List all comments on an issue", + "operationId": "issueGetComments", "parameters": [ { "type": "string", @@ -1951,9 +1934,16 @@ "in": "path", "required": true }, + { + "type": "integer", + "description": "index of the issue", + "name": "id", + "in": "path", + "required": true + }, { "type": "string", - "description": "if provided, only comments updated since the provided time are returned.", + "description": "if provided, only comments updated since the specified time are returned.", "name": "string", "in": "query" } @@ -1963,15 +1953,64 @@ "$ref": "#/responses/CommentList" } } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Add a comment to an issue", + "operationId": "issueCreateComment", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "index of the issue", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateIssueOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Comment" + } + } } }, - "/repos/{owner}/{repo}/issues/comments/{id}": { + "/repos/{owner}/{repo}/issues/{index}/comments/{id}": { "delete": { "tags": [ "issue" ], "summary": "Delete a comment", - "operationId": "issueDeleteComment", + "operationId": "issueDeleteCommentDeprecated", + "deprecated": true, "parameters": [ { "type": "string", @@ -1987,6 +2026,13 @@ "in": "path", "required": true }, + { + "type": "integer", + "description": "this parameter is ignored", + "name": "index", + "in": "path", + "required": true + }, { "type": "integer", "description": "id of comment to delete", @@ -2012,7 +2058,8 @@ "issue" ], "summary": "Edit a comment", - "operationId": "issueEditComment", + "operationId": "issueEditCommentDeprecated", + "deprecated": true, "parameters": [ { "type": "string", @@ -2028,6 +2075,13 @@ "in": "path", "required": true }, + { + "type": "integer", + "description": "this parameter is ignored", + "name": "index", + "in": "path", + "required": true + }, { "type": "integer", "description": "id of the comment to edit", @@ -2050,7 +2104,7 @@ } } }, - "/repos/{owner}/{repo}/issues/{index}": { + "/repos/{owner}/{repo}/issues/{index}/labels": { "get": { "produces": [ "application/json" @@ -2058,8 +2112,8 @@ "tags": [ "issue" ], - "summary": "Get an issue", - "operationId": "issueGetIssue", + "summary": "Get an issue's labels", + "operationId": "issueGetLabels", "parameters": [ { "type": "string", @@ -2077,7 +2131,7 @@ }, { "type": "integer", - "description": "index of the issue to get", + "description": "index of the issue", "name": "index", "in": "path", "required": true @@ -2085,11 +2139,14 @@ ], "responses": { "200": { - "$ref": "#/responses/Issue" + "$ref": "#/responses/LabelList" + }, + "404": { + "$ref": "#/responses/notFound" } } }, - "patch": { + "put": { "consumes": [ "application/json" ], @@ -2099,8 +2156,8 @@ "tags": [ "issue" ], - "summary": "Edit an issue", - "operationId": "issueEditIssue", + "summary": "Replace an issue's labels", + "operationId": "issueReplaceLabels", "parameters": [ { "type": "string", @@ -2118,7 +2175,7 @@ }, { "type": "integer", - "description": "index of the issue to edit", + "description": "index of the issue", "name": "index", "in": "path", "required": true @@ -2127,18 +2184,16 @@ "name": "body", "in": "body", "schema": { - "$ref": "#/definitions/EditIssueOption" + "$ref": "#/definitions/IssueLabelsOption" } } ], "responses": { - "201": { - "$ref": "#/responses/Issue" + "200": { + "$ref": "#/responses/LabelList" } } - } - }, - "/repos/{owner}/{repo}/issues/{index}/comments": { + }, "post": { "consumes": [ "application/json" @@ -2149,8 +2204,8 @@ "tags": [ "issue" ], - "summary": "Add a comment to an issue", - "operationId": "issueCreateComment", + "summary": "Add a label to an issue", + "operationId": "issueAddLabel", "parameters": [ { "type": "string", @@ -2169,7 +2224,7 @@ { "type": "integer", "description": "index of the issue", - "name": "id", + "name": "index", "in": "path", "required": true }, @@ -2177,25 +2232,25 @@ "name": "body", "in": "body", "schema": { - "$ref": "#/definitions/CreateIssueOption" + "$ref": "#/definitions/IssueLabelsOption" } } ], "responses": { - "201": { - "$ref": "#/responses/Comment" + "200": { + "$ref": "#/responses/LabelList" } } - } - }, - "/repos/{owner}/{repo}/issues/{index}/comments/{id}": { + }, "delete": { + "produces": [ + "application/json" + ], "tags": [ "issue" ], - "summary": "Delete a comment", - "operationId": "issueDeleteCommentDeprecated", - "deprecated": true, + "summary": "Remove all labels from an issue", + "operationId": "issueClearLabels", "parameters": [ { "type": "string", @@ -2213,17 +2268,10 @@ }, { "type": "integer", - "description": "this parameter is ignored", + "description": "index of the issue", "name": "index", "in": "path", "required": true - }, - { - "type": "integer", - "description": "id of comment to delete", - "name": "id", - "in": "path", - "required": true } ], "responses": { @@ -2231,20 +2279,18 @@ "$ref": "#/responses/empty" } } - }, - "patch": { - "consumes": [ - "application/json" - ], + } + }, + "/repos/{owner}/{repo}/issues/{index}/labels/{id}": { + "delete": { "produces": [ "application/json" ], "tags": [ "issue" ], - "summary": "Edit a comment", - "operationId": "issueEditCommentDeprecated", - "deprecated": true, + "summary": "Remove a label from an issue", + "operationId": "issueRemoveLabel", "parameters": [ { "type": "string", @@ -2262,72 +2308,22 @@ }, { "type": "integer", - "description": "this parameter is ignored", + "description": "index of the issue", "name": "index", "in": "path", "required": true }, { "type": "integer", - "description": "id of the comment to edit", + "description": "id of the label to remove", "name": "id", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "schema": { - "$ref": "#/definitions/EditIssueCommentOption" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/Comment" - } - } - } - }, - "/repos/{owner}/{repo}/issues/{index}/labels": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "issue" - ], - "summary": "Get an issue's labels", - "operationId": "issueGetLabels", - "parameters": [ - { - "type": "string", - "description": "owner of the repo", - "name": "owner", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "name of the repo", - "name": "repo", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "index of the issue", - "name": "index", - "in": "path", - "required": true } ], "responses": { - "200": { - "$ref": "#/responses/LabelList" - }, - "404": { - "$ref": "#/responses/notFound" + "204": { + "$ref": "#/responses/empty" } } } diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go index 5fb50550f..a9258849e 100644 --- a/routers/api/v1/repo/issue_comment.go +++ b/routers/api/v1/repo/issue_comment.go @@ -15,7 +15,7 @@ import ( // ListIssueComments list all the comments of an issue func ListIssueComments(ctx *context.APIContext) { - // swagger:operation GET /repos/{owner}/{repo}/issue/{index}/comments issue issueGetComments + // swagger:operation GET /repos/{owner}/{repo}/issues/{index}/comments issue issueGetComments // --- // summary: List all comments on an issue // produces: diff --git a/routers/api/v1/repo/issue_label.go b/routers/api/v1/repo/issue_label.go index 95ea19d54..3657f02c6 100644 --- a/routers/api/v1/repo/issue_label.go +++ b/routers/api/v1/repo/issue_label.go @@ -58,7 +58,7 @@ func ListIssueLabels(ctx *context.APIContext) { // AddIssueLabels add labels for an issue func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) { - // swagger:operation POST /repos/{owner}/{repo}/issue/{index}/labels issue issueAddLabel + // swagger:operation POST /repos/{owner}/{repo}/issues/{index}/labels issue issueAddLabel // --- // summary: Add a label to an issue // consumes: @@ -129,7 +129,7 @@ func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) { // DeleteIssueLabel delete a label for an issue func DeleteIssueLabel(ctx *context.APIContext) { - // swagger:operation DELETE /repos/{owner}/{repo}/issue/{index}/labels/{id} issue issueRemoveLabel + // swagger:operation DELETE /repos/{owner}/{repo}/issues/{index}/labels/{id} issue issueRemoveLabel // --- // summary: Remove a label from an issue // produces: @@ -193,7 +193,7 @@ func DeleteIssueLabel(ctx *context.APIContext) { // ReplaceIssueLabels replace labels for an issue func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) { - // swagger:operation PUT /repos/{owner}/{repo}/issue/{index}/labels issue issueReplaceLabels + // swagger:operation PUT /repos/{owner}/{repo}/issues/{index}/labels issue issueReplaceLabels // --- // summary: Replace an issue's labels // consumes: @@ -264,7 +264,7 @@ func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) { // ClearIssueLabels delete all the labels for an issue func ClearIssueLabels(ctx *context.APIContext) { - // swagger:operation DELETE /repos/{owner}/{repo}/issue/{index}/labels issue issueClearLabels + // swagger:operation DELETE /repos/{owner}/{repo}/issues/{index}/labels issue issueClearLabels // --- // summary: Remove all labels from an issue // produces: