diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2017-05-02 15:35:59 +0200 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-05-02 15:35:59 +0200 |
commit | 3edb0c58943c003ed3f209b2197d1f43484a3432 (patch) | |
tree | e5849cead5053ab505a2c5dc1342111c6bcf0816 /routers/api/v1/misc | |
parent | bb5f694fc57c3ade9c13e841b9a237f4e192da22 (diff) | |
download | gitea-3edb0c58943c003ed3f209b2197d1f43484a3432.tar.gz gitea-3edb0c58943c003ed3f209b2197d1f43484a3432.zip |
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
Diffstat (limited to 'routers/api/v1/misc')
-rw-r--r-- | routers/api/v1/misc/markdown.go | 25 | ||||
-rw-r--r-- | routers/api/v1/misc/version.go | 12 |
2 files changed, 35 insertions, 2 deletions
diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go index 188594e83e..0d346a9270 100644 --- a/routers/api/v1/misc/markdown.go +++ b/routers/api/v1/misc/markdown.go @@ -13,8 +13,19 @@ import ( ) // Markdown render markdown document to HTML -// see https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-an-arbitrary-markdown-document func Markdown(ctx *context.APIContext, form api.MarkdownOption) { + // swagger:route POST /markdown renderMarkdown + // + // Consumes: + // - application/json + // + // Produces: + // - text/html + // + // Responses: + // 200: MarkdownRender + // 422: validationError + if ctx.HasAPIError() { ctx.Error(422, "", ctx.GetErrMsg()) return @@ -40,8 +51,18 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) { } // MarkdownRaw render raw markdown HTML -// see https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-a-markdown-document-in-raw-mode func MarkdownRaw(ctx *context.APIContext) { + // swagger:route POST /markdown/raw renderMarkdownRaw + // + // Consumes: + // - text/plain + // + // Produces: + // - text/html + // + // Responses: + // 200: MarkdownRender + // 422: validationError body, err := ctx.Req.Body().Bytes() if err != nil { ctx.Error(422, "", err) diff --git a/routers/api/v1/misc/version.go b/routers/api/v1/misc/version.go index 92950c19c3..ed4107eb33 100644 --- a/routers/api/v1/misc/version.go +++ b/routers/api/v1/misc/version.go @@ -12,5 +12,17 @@ import ( // Version shows the version of the Gitea server func Version(ctx *context.APIContext) { + // swagger:route GET /version getVersion + // + // Return Gitea running version. + // + // This show current running Gitea application version. + // + // Produces: + // - application/json + // + // Responses: + // 200: ServerVersion + ctx.JSON(200, &gitea.ServerVersion{Version: setting.AppVer}) } |