1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

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

@@ -13,7 +13,7 @@ import (
// ListAccessTokens list all the access tokens
func ListAccessTokens(ctx *context.APIContext) {
// swagger:route GET /users/{username}/tokens userGetTokens
// swagger:route GET /users/{username}/tokens user userGetTokens
//
// Produces:
// - application/json
@@ -40,7 +40,7 @@ func ListAccessTokens(ctx *context.APIContext) {
// CreateAccessToken create access tokens
func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
// swagger:route POST /users/{username} /tokens userCreateToken
// swagger:route POST /users/{username} /tokens user userCreateToken
//
// Consumes:
// - application/json

View File

@@ -30,7 +30,7 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) {
// ListMyFollowers list all my followers
func ListMyFollowers(ctx *context.APIContext) {
// swagger:route GET /user/followers userCurrentListFollowers
// swagger:route GET /user/followers user userCurrentListFollowers
//
// Produces:
// - application/json
@@ -44,7 +44,7 @@ func ListMyFollowers(ctx *context.APIContext) {
// ListFollowers list user's followers
func ListFollowers(ctx *context.APIContext) {
// swagger:route GET /users/:username/followers userListFollowers
// swagger:route GET /users/:username/followers user userListFollowers
//
// Produces:
// - application/json
@@ -71,7 +71,7 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) {
// ListMyFollowing list all my followings
func ListMyFollowing(ctx *context.APIContext) {
// swagger:route GET /user/following userCurrentListFollowing
// swagger:route GET /user/following user userCurrentListFollowing
//
// Produces:
// - application/json
@@ -85,7 +85,7 @@ func ListMyFollowing(ctx *context.APIContext) {
// ListFollowing list user's followings
func ListFollowing(ctx *context.APIContext) {
// swagger:route GET /users/{username}/following userListFollowing
// swagger:route GET /users/{username}/following user userListFollowing
//
// Produces:
// - application/json
@@ -111,7 +111,7 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64)
// CheckMyFollowing check if the repo is followed by me
func CheckMyFollowing(ctx *context.APIContext) {
// swagger:route GET /user/following/{username} userCurrentCheckFollowing
// swagger:route GET /user/following/{username} user userCurrentCheckFollowing
//
// Responses:
// 204: empty
@@ -126,7 +126,7 @@ func CheckMyFollowing(ctx *context.APIContext) {
// CheckFollowing check if the repo is followed by user
func CheckFollowing(ctx *context.APIContext) {
// swagger:route GET /users/{username}/following/:target userCheckFollowing
// swagger:route GET /users/{username}/following/:target user userCheckFollowing
//
// Responses:
// 204: empty
@@ -145,7 +145,7 @@ func CheckFollowing(ctx *context.APIContext) {
// Follow follow one repository
func Follow(ctx *context.APIContext) {
// swagger:route PUT /user/following/{username} userCurrentPutFollow
// swagger:route PUT /user/following/{username} user userCurrentPutFollow
//
// Responses:
// 204: empty
@@ -164,7 +164,7 @@ func Follow(ctx *context.APIContext) {
// Unfollow unfollow one repository
func Unfollow(ctx *context.APIContext) {
// swagger:route DELETE /user/following/{username} userCurrentDeleteFollow
// swagger:route DELETE /user/following/{username} user userCurrentDeleteFollow
//
// Responses:
// 204: empty

View File

@@ -34,7 +34,7 @@ func listGPGKeys(ctx *context.APIContext, uid int64) {
//ListGPGKeys get the GPG key list of a user
func ListGPGKeys(ctx *context.APIContext) {
// swagger:route GET /users/{username}/gpg_keys userListGPGKeys
// swagger:route GET /users/{username}/gpg_keys user userListGPGKeys
//
// Produces:
// - application/json
@@ -52,7 +52,7 @@ func ListGPGKeys(ctx *context.APIContext) {
//ListMyGPGKeys get the GPG key list of the logged user
func ListMyGPGKeys(ctx *context.APIContext) {
// swagger:route GET /user/gpg_keys userCurrentListGPGKeys
// swagger:route GET /user/gpg_keys user userCurrentListGPGKeys
//
// Produces:
// - application/json
@@ -66,7 +66,7 @@ func ListMyGPGKeys(ctx *context.APIContext) {
//GetGPGKey get the GPG key based on a id
func GetGPGKey(ctx *context.APIContext) {
// swagger:route GET /user/gpg_keys/{id} userCurrentGetGPGKey
// swagger:route GET /user/gpg_keys/{id} user userCurrentGetGPGKey
//
// Produces:
// - application/json
@@ -100,7 +100,7 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid
//CreateGPGKey associate a GPG key to the current user
func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
// swagger:route POST /user/gpg_keys userCurrentPostGPGKey
// swagger:route POST /user/gpg_keys user userCurrentPostGPGKey
//
// Consumes:
// - application/json
@@ -118,7 +118,7 @@ func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
//DeleteGPGKey remove a GPG key associated to the current user
func DeleteGPGKey(ctx *context.APIContext) {
// swagger:route DELETE /user/gpg_keys/{id} userCurrentDeleteGPGKey
// swagger:route DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
//
// Produces:
// - application/json

View File

@@ -55,7 +55,7 @@ func listPublicKeys(ctx *context.APIContext, uid int64) {
// ListMyPublicKeys list all my public keys
func ListMyPublicKeys(ctx *context.APIContext) {
// swagger:route GET /user/keys userCurrentListKeys
// swagger:route GET /user/keys user userCurrentListKeys
//
// Produces:
// - application/json
@@ -69,7 +69,7 @@ func ListMyPublicKeys(ctx *context.APIContext) {
// ListPublicKeys list all user's public keys
func ListPublicKeys(ctx *context.APIContext) {
// swagger:route GET /users/{username}/keys userListKeys
// swagger:route GET /users/{username}/keys user userListKeys
//
// Produces:
// - application/json
@@ -87,7 +87,7 @@ func ListPublicKeys(ctx *context.APIContext) {
// GetPublicKey get one public key
func GetPublicKey(ctx *context.APIContext) {
// swagger:route GET /user/keys/{id} userCurrentGetKey
// swagger:route GET /user/keys/{id} user userCurrentGetKey
//
// Produces:
// - application/json
@@ -130,7 +130,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
// CreatePublicKey create one public key for me
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// swagger:route POST /user/keys userCurrentPostKey
// swagger:route POST /user/keys user userCurrentPostKey
//
// Consumes:
// - application/json
@@ -148,7 +148,7 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// DeletePublicKey delete one public key of mine
func DeletePublicKey(ctx *context.APIContext) {
// swagger:route DELETE /user/keys/{id} userCurrentDeleteKey
// swagger:route DELETE /user/keys/{id} user userCurrentDeleteKey
//
// Produces:
// - application/json

View File

@@ -36,7 +36,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
// ListUserRepos - list the repos owned by the given user.
func ListUserRepos(ctx *context.APIContext) {
// swagger:route GET /users/{username}/repos userListRepos
// swagger:route GET /users/{username}/repos user userListRepos
//
// Produces:
// - application/json
@@ -54,7 +54,7 @@ func ListUserRepos(ctx *context.APIContext) {
// ListMyRepos - list the repositories you own or have access to.
func ListMyRepos(ctx *context.APIContext) {
// swagger:route GET /user/repos userCurrentListRepos
// swagger:route GET /user/repos user userCurrentListRepos
//
// Produces:
// - application/json
@@ -87,7 +87,7 @@ func ListMyRepos(ctx *context.APIContext) {
// ListOrgRepos - list the repositories of an organization.
func ListOrgRepos(ctx *context.APIContext) {
// swagger:route GET /orgs/{org}/repos orgListRepos
// swagger:route GET /orgs/{orgname}/repos organization orgListRepos
//
// Produces:
// - application/json

View File

@@ -33,7 +33,7 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) {
// GetStarredRepos returns the repos that the user specified by the APIContext
// has starred
func GetStarredRepos(ctx *context.APIContext) {
// swagger:route GET /users/{username}/starred userListStarred
// swagger:route GET /users/{username}/starred user userListStarred
//
// Produces:
// - application/json
@@ -53,7 +53,7 @@ func GetStarredRepos(ctx *context.APIContext) {
// GetMyStarredRepos returns the repos that the authenticated user has starred
func GetMyStarredRepos(ctx *context.APIContext) {
// swagger:route GET /user/starred userCurrentListStarred
// swagger:route GET /user/starred user userCurrentListStarred
//
// Produces:
// - application/json
@@ -71,7 +71,7 @@ func GetMyStarredRepos(ctx *context.APIContext) {
// IsStarring returns whether the authenticated is starring the repo
func IsStarring(ctx *context.APIContext) {
// swagger:route GET /user/starred/{username}/{reponame} userCurrentCheckStarring
// swagger:route GET /user/starred/{username}/{reponame} user userCurrentCheckStarring
//
// Responses:
// 204: empty
@@ -86,7 +86,7 @@ func IsStarring(ctx *context.APIContext) {
// Star the repo specified in the APIContext, as the authenticated user
func Star(ctx *context.APIContext) {
// swagger:route PUT /user/starred/{username}/{reponame} userCurrentPutStar
// swagger:route PUT /user/starred/{username}/{reponame} user userCurrentPutStar
//
// Responses:
// 204: empty
@@ -102,7 +102,7 @@ func Star(ctx *context.APIContext) {
// Unstar the repo specified in the APIContext, as the authenticated user
func Unstar(ctx *context.APIContext) {
// swagger:route DELETE /user/starred/{username}/{reponame} userCurrentDeleteStar
// swagger:route DELETE /user/starred/{username}/{reponame} user userCurrentDeleteStar
//
// Responses:
// 204: empty

View File

@@ -17,7 +17,7 @@ import (
// Search search users
func Search(ctx *context.APIContext) {
// swagger:route GET /users/search userSearch
// swagger:route GET /users/search user userSearch
//
// Produces:
// - application/json
@@ -65,7 +65,7 @@ func Search(ctx *context.APIContext) {
// GetInfo get user's information
func GetInfo(ctx *context.APIContext) {
// swagger:route GET /users/{username} userGet
// swagger:route GET /users/{username} user userGet
//
// Produces:
// - application/json
@@ -94,7 +94,7 @@ func GetInfo(ctx *context.APIContext) {
// GetAuthenticatedUser get curent user's information
func GetAuthenticatedUser(ctx *context.APIContext) {
// swagger:route GET /user userGetCurrent
// swagger:route GET /user user userGetCurrent
//
// Produces:
// - application/json

View File

@@ -33,7 +33,7 @@ func getWatchedRepos(userID int64, private bool) ([]*api.Repository, error) {
// GetWatchedRepos returns the repos that the user specified in ctx is watching
func GetWatchedRepos(ctx *context.APIContext) {
// swagger:route GET /users/{username}/subscriptions userListSubscriptions
// swagger:route GET /users/{username}/subscriptions user userListSubscriptions
//
// Produces:
// - application/json
@@ -53,7 +53,7 @@ func GetWatchedRepos(ctx *context.APIContext) {
// GetMyWatchedRepos returns the repos that the authenticated user is watching
func GetMyWatchedRepos(ctx *context.APIContext) {
// swagger:route GET /user/subscriptions userCurrentListSubscriptions
// swagger:route GET /user/subscriptions user userCurrentListSubscriptions
//
// Produces:
// - application/json
@@ -72,7 +72,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) {
// IsWatching returns whether the authenticated user is watching the repo
// specified in ctx
func IsWatching(ctx *context.APIContext) {
// swagger:route GET /repos/{username}/{reponame}/subscription userCurrentCheckSubscription
// swagger:route GET /repos/{username}/{reponame}/subscription repository userCurrentCheckSubscription
//
// Responses:
// 200: WatchInfo
@@ -94,7 +94,7 @@ func IsWatching(ctx *context.APIContext) {
// Watch the repo specified in ctx, as the authenticated user
func Watch(ctx *context.APIContext) {
// swagger:route PUT /repos/{username}/{reponame}/subscription userCurrentPutSubscription
// swagger:route PUT /repos/{username}/{reponame}/subscription repository userCurrentPutSubscription
//
// Responses:
// 200: WatchInfo
@@ -118,7 +118,7 @@ func Watch(ctx *context.APIContext) {
// Unwatch the repo specified in ctx, as the authenticated user
func Unwatch(ctx *context.APIContext) {
// swagger:route DELETE /repos/{username}/{reponame}/subscription userCurrentDeleteSubscription
// swagger:route DELETE /repos/{username}/{reponame}/subscription repository userCurrentDeleteSubscription
//
// Responses:
// 204: empty