diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2017-08-21 13:13:47 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-08-21 14:13:47 +0300 |
commit | fd8e8a421ae21f8c68eaad195bdd4881e1d34b21 (patch) | |
tree | 2c651e0f39a0360496d1fbbd1f4d0fd03ec9a95f /routers/api/v1/repo/repo.go | |
parent | 951c909a67bb6f1f8577fb1e61f22dca2bc3c07f (diff) | |
download | gitea-fd8e8a421ae21f8c68eaad195bdd4881e1d34b21.tar.gz gitea-fd8e8a421ae21f8c68eaad195bdd4881e1d34b21.zip |
Improve swagger doc (#2274)
* Add swagger comment for adminCreateOrg
* Add swagger comment for admin route
* add hook swagger doc
* Add tags
* Add auth
* Fix name of responses
* Edit name method
* Update vendor
* make generate-swagger
Diffstat (limited to 'routers/api/v1/repo/repo.go')
-rw-r--r-- | routers/api/v1/repo/repo.go | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index e44159817e..e8bf026511 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -20,7 +20,7 @@ import ( // Search repositories via options func Search(ctx *context.APIContext) { - // swagger:route GET /repos/search repoSearch + // swagger:route GET /repos/search repository repoSearch // // Produces: // - application/json @@ -130,8 +130,21 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR } // Create one repository of mine -// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create func Create(ctx *context.APIContext, opt api.CreateRepoOption) { + // swagger:route POST /user/repos repository user createCurrentUserRepo + // + // Consumes: + // - application/json + // + // Produces: + // - application/json + // + // Responses: + // 201: Repository + // 403: forbidden + // 422: validationError + // 500: error + // Shouldn't reach this condition, but just in case. if ctx.User.IsOrganization() { ctx.Error(422, "", "not allowed creating repository for organization") @@ -142,7 +155,7 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) { // CreateOrgRepo create one repository of the organization func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { - // swagger:route POST /org/{org}/repos createOrgRepo + // swagger:route POST /org/{org}/repos organization createOrgRepo // // Consumes: // - application/json @@ -175,7 +188,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) { // Migrate migrate remote git repository to gitea func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { - // swagger:route POST /repos/migrate + // swagger:route POST /repos/migrate repository repoMigrate // // Consumes: // - application/json @@ -260,7 +273,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { // Get one repository func Get(ctx *context.APIContext) { - // swagger:route GET /repos/{username}/{reponame} + // swagger:route GET /repos/{username}/{reponame} repository repoGet // // Produces: // - application/json @@ -274,7 +287,7 @@ func Get(ctx *context.APIContext) { // GetByID returns a single Repository func GetByID(ctx *context.APIContext) { - // swagger:route GET /repositories/{id} + // swagger:route GET /repositories/{id} repository repoGetByID // // Produces: // - application/json @@ -306,7 +319,7 @@ func GetByID(ctx *context.APIContext) { // Delete one repository func Delete(ctx *context.APIContext) { - // swagger:route DELETE /repos/{username}/{reponame} + // swagger:route DELETE /repos/{username}/{reponame} repository repoDelete // // Produces: // - application/json @@ -339,7 +352,7 @@ func Delete(ctx *context.APIContext) { // MirrorSync adds a mirrored repository to the sync queue func MirrorSync(ctx *context.APIContext) { - // swagger:route POST /repos/{username}/{reponame}/mirror-sync repoMirrorSync + // swagger:route POST /repos/{username}/{reponame}/mirror-sync repository repoMirrorSync // // Produces: // - application/json |