mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Generate swagger json (#1402)
- Generate swagger.json into public/ - Add swagger-ui auto-installation - Add footer link to local swagger-ui - Add /swagger url for using app url. - Fix Swagger-UI version via git tag
This commit is contained in:
committed by
Kim "BKC" Carlbäcker
parent
bb5f694fc5
commit
3edb0c5894
@@ -17,6 +17,15 @@ import (
|
||||
|
||||
// Search search users
|
||||
func Search(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/search userSearch
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: UserList
|
||||
// 500: error
|
||||
|
||||
opts := &models.SearchUserOptions{
|
||||
Keyword: strings.Trim(ctx.Query("q"), " "),
|
||||
Type: models.UserTypeIndividual,
|
||||
@@ -56,6 +65,16 @@ func Search(ctx *context.APIContext) {
|
||||
|
||||
// GetInfo get user's information
|
||||
func GetInfo(ctx *context.APIContext) {
|
||||
// swagger:route GET /users/{username} userGet
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: User
|
||||
// 404: notFound
|
||||
// 500: error
|
||||
|
||||
u, err := models.GetUserByName(ctx.Params(":username"))
|
||||
if err != nil {
|
||||
if models.IsErrUserNotExist(err) {
|
||||
@@ -75,5 +94,13 @@ func GetInfo(ctx *context.APIContext) {
|
||||
|
||||
// GetAuthenticatedUser get curent user's information
|
||||
func GetAuthenticatedUser(ctx *context.APIContext) {
|
||||
// swagger:route GET /user userGetCurrent
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: User
|
||||
|
||||
ctx.JSON(200, ctx.User.APIFormat())
|
||||
}
|
||||
|
Reference in New Issue
Block a user