mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-27 15:25:25 +00:00
26 lines
782 B
Go
26 lines
782 B
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package web
|
|
|
|
import (
|
|
"html/template"
|
|
|
|
"gitea.dev/modules/setting"
|
|
"gitea.dev/services/context"
|
|
)
|
|
|
|
// SwaggerV1Json render swagger v1 json
|
|
func SwaggerV1Json(ctx *context.Context) {
|
|
ctx.Data["SwaggerAppVer"] = template.HTML(template.JSEscapeString(setting.AppVer))
|
|
ctx.Data["SwaggerAppSubUrl"] = setting.AppSubURL // it is JS-safe
|
|
ctx.JSONTemplate("swagger/v1_json")
|
|
}
|
|
|
|
// OpenAPI3Json render OpenAPI 3.0 json (auto-converted from Swagger 2.0)
|
|
func OpenAPI3Json(ctx *context.Context) {
|
|
ctx.Data["SwaggerAppVer"] = template.HTML(template.JSEscapeString(setting.AppVer))
|
|
ctx.Data["SwaggerAppSubUrl"] = setting.AppSubURL // it is JS-safe
|
|
ctx.JSONTemplate("swagger/v1_openapi3_json")
|
|
}
|