diff options
author | Piotr Orzechowski <piotr@orzechowski.tech> | 2018-07-28 02:19:01 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-07-28 03:19:01 +0300 |
commit | a74426d631e3311cc3c460ae9917f76f0221f4de (patch) | |
tree | 1343766d999308825f42bc0b67c1845a5e9e9546 /routers/routes | |
parent | 412583a3f28162c89e827fbb586319ac8eea9825 (diff) | |
download | gitea-a74426d631e3311cc3c460ae9917f76f0221f4de.tar.gz gitea-a74426d631e3311cc3c460ae9917f76f0221f4de.zip |
Swagger.v1.json template (#3572)
* Turn swagger.v1.json into template
* Rename ENABLE_SWAGGER_ENDPOINT option to ENABLE_SWAGGER
Diffstat (limited to 'routers/routes')
-rw-r--r-- | routers/routes/routes.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 3eaaff60b6..8c196d8bb2 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -79,7 +79,7 @@ func NewMacaron() *macaron.Macaron { }, )) - m.Use(templates.Renderer()) + m.Use(templates.HTMLRenderer()) models.InitMailRender(templates.Mailer()) localeNames, err := options.Dir("locale") @@ -755,6 +755,10 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/purge", user.NotificationPurgePost) }, reqSignIn) + if setting.API.EnableSwagger { + m.Get("/swagger.v1.json", templates.JSONRenderer(), routers.SwaggerV1Json) + } + m.Group("/api", func() { apiv1.RegisterRoutes(m) }, ignSignIn) |