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
This commit is contained in:
Antoine GIRARD 2017-08-21 13:13:47 +02:00 committed by Lauris BH
parent 951c909a67
commit fd8e8a421a
32 changed files with 1911 additions and 110 deletions

View file

@ -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