]> source.dussan.org Git - gitea.git/commitdiff
Add repo fork swagger (#1941)
authorJonas Östanbäck <cez81@users.noreply.github.com>
Mon, 12 Jun 2017 00:59:51 +0000 (02:59 +0200)
committerLunny Xiao <xiaolunwen@gmail.com>
Mon, 12 Jun 2017 00:59:51 +0000 (08:59 +0800)
public/swagger.v1.json
routers/api/v1/repo/fork.go

index 62c9fd3c48071af9c59b276b4e49901936e01300..68f8227933089c812b90099bc93c97b68e6b7604 100644 (file)
         }
       }
     },
+    "/repos/{owner}/{repo}/forks": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "operationId": "listForks",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          },
+          "500": {
+            "$ref": "#/responses/error"
+          }
+        }
+      },
+      "post": {
+        "produces": [
+          "application/json"
+        ],
+        "operationId": "createFork",
+        "responses": {
+          "202": {
+            "$ref": "#/responses/Repository"
+          },
+          "403": {
+            "$ref": "#/responses/forbidden"
+          },
+          "422": {
+            "$ref": "#/responses/validationError"
+          },
+          "500": {
+            "$ref": "#/responses/error"
+          }
+        }
+      }
+    },
     "/repos/{username}/{reponame}/mirror-sync": {
       "post": {
         "produces": [
index 9c6da754ef8b4c6292915c29728d77637758e872..c743aec301dda899b32da30183018ddbcff75c91 100644 (file)
@@ -13,6 +13,15 @@ import (
 
 // ListForks list a repository's forks
 func ListForks(ctx *context.APIContext) {
+       // swagger:route GET /repos/{owner}/{repo}/forks listForks
+       //
+       //     Produces:
+       //     - application/json
+       //
+       //     Responses:
+       //       200: RepositoryList
+       //       500: error
+
        forks, err := ctx.Repo.Repository.GetForks()
        if err != nil {
                ctx.Error(500, "GetForks", err)
@@ -32,6 +41,17 @@ func ListForks(ctx *context.APIContext) {
 
 // CreateFork create a fork of a repo
 func CreateFork(ctx *context.APIContext, form api.CreateForkOption) {
+       // swagger:route POST /repos/{owner}/{repo}/forks createFork
+       //
+       //     Produces:
+       //     - application/json
+       //
+       //     Responses:
+       //       202: Repository
+       //       403: forbidden
+       //       422: validationError
+       //       500: error
+
        repo := ctx.Repo.Repository
        var forker *models.User // user/org that will own the fork
        if form.Organization == nil {