code.gitea.io/gitea@v1.21.7/routers/web/misc/swagger.go (about) 1 // Copyright 2017 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package misc 5 6 import ( 7 "net/http" 8 9 "code.gitea.io/gitea/modules/base" 10 "code.gitea.io/gitea/modules/context" 11 ) 12 13 // tplSwagger swagger page template 14 const tplSwagger base.TplName = "swagger/ui" 15 16 // Swagger render swagger-ui page with v1 json 17 func Swagger(ctx *context.Context) { 18 ctx.Data["APIJSONVersion"] = "v1" 19 ctx.HTML(http.StatusOK, tplSwagger) 20 }