diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-11-12 23:02:25 -0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-11-13 09:02:25 +0200 |
commit | f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f (patch) | |
tree | 39c2fc0abc5a10f80f8fa31b3bd57ec3604bf7fd /routers/api/v1/misc | |
parent | 4287d100b39ff89e297ba8945e54fb5911226974 (diff) | |
download | gitea-f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f.tar.gz gitea-f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f.zip |
Update swagger documentation (#2899)
* Update swagger documentation
Add docs for missing endpoints
Add documentation for request parameters
Make parameter naming consistent
Fix response documentation
* Restore delete comments
Diffstat (limited to 'routers/api/v1/misc')
-rw-r--r-- | routers/api/v1/misc/markdown.go | 50 | ||||
-rw-r--r-- | routers/api/v1/misc/version.go | 20 |
2 files changed, 38 insertions, 32 deletions
diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go index 8e3c66841f..ed50c1c05b 100644 --- a/routers/api/v1/misc/markdown.go +++ b/routers/api/v1/misc/markdown.go @@ -15,18 +15,23 @@ import ( // Markdown render markdown document to HTML func Markdown(ctx *context.APIContext, form api.MarkdownOption) { - // swagger:route POST /markdown miscellaneous renderMarkdown - // - // Consumes: - // - application/json - // - // Produces: + // swagger:operation POST /markdown miscellaneous renderMarkdown + // --- + // summary: Render a markdown document as HTML + // parameters: + // - name: body + // in: body + // schema: + // "$ref": "#/definitions/MarkdownOption" + // consumes: + // - application/json + // produces: // - text/html - // - // Responses: - // 200: MarkdownRender - // 422: validationError - + // responses: + // "200": + // "$ref": "#/responses/MarkdownRender" + // "422": + // "$ref": "#/responses/validationError" if ctx.HasAPIError() { ctx.Error(422, "", ctx.GetErrMsg()) return @@ -53,17 +58,22 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) { // MarkdownRaw render raw markdown HTML func MarkdownRaw(ctx *context.APIContext) { - // swagger:route POST /markdown/raw miscellaneous renderMarkdownRaw - // - // Consumes: + // swagger:operation POST /markdown/raw miscellaneous renderMarkdownRaw + // --- + // summary: Render raw markdown as HTML + // parameters: + // - name: body + // in: body + // type: string + // consumes: // - text/plain - // - // Produces: + // produces: // - text/html - // - // Responses: - // 200: MarkdownRender - // 422: validationError + // responses: + // "200": + // "$ref": "#/responses/MarkdownRender" + // "422": + // "$ref": "#/responses/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 1780398bf9..20e0a60c72 100644 --- a/routers/api/v1/misc/version.go +++ b/routers/api/v1/misc/version.go @@ -12,17 +12,13 @@ import ( // Version shows the version of the Gitea server func Version(ctx *context.APIContext) { - // swagger:route GET /version miscellaneous getVersion - // - // Return Gitea running version. - // - // This show current running Gitea application version. - // - // Produces: - // - application/json - // - // Responses: - // 200: ServerVersion - + // swagger:operation GET /version miscellaneous getVersion + // --- + // summary: Returns the version of the Gitea application + // produces: + // - application/json + // responses: + // "200": + // "$ref": "#/responses/ServerVersion" ctx.JSON(200, &gitea.ServerVersion{Version: setting.AppVer}) } |