forked from kevadesu/forgejo
[API] Forgejo API /api/forgejo/v1
(cherry picked from commit20b5669269
) (cherry picked from commit1574643a6a
) Update semantic version according to specification (cherry picked from commit22510f4130
) Mise à jour de 'Makefile' (cherry picked from commitc3d85d8409
) (cherry picked from commit5ea2309851
) (cherry picked from commitec5217b9d1
) (cherry picked from commit14f08e364b
)
This commit is contained in:
parent
a03e449c01
commit
b4465c67b8
14 changed files with 401 additions and 3 deletions
19
routers/web/misc/swagger-forgejo.go
Normal file
19
routers/web/misc/swagger-forgejo.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package misc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
)
|
||||
|
||||
// tplSwagger swagger page template
|
||||
const tplForgejoSwagger base.TplName = "swagger/forgejo-ui"
|
||||
|
||||
func SwaggerForgejo(ctx *context.Context) {
|
||||
ctx.Data["APIVersion"] = "v1"
|
||||
ctx.HTML(http.StatusOK, tplForgejoSwagger)
|
||||
}
|
|
@ -211,6 +211,7 @@ func Routes(ctx gocontext.Context) *web.Route {
|
|||
if setting.API.EnableSwagger {
|
||||
// Note: The route moved from apiroutes because it's in fact want to render a web page
|
||||
routes.Get("/api/swagger", append(common, misc.Swagger)...) // Render V1 by default
|
||||
routes.Get("/api/forgejo/swagger", append(common, misc.SwaggerForgejo)...)
|
||||
}
|
||||
|
||||
// TODO: These really seem like things that could be folded into Contexter or as helper functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue