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
This commit is contained in:
Ethan Koenig 2017-11-12 23:02:25 -08:00 committed by Lauris BH
parent 4287d100b3
commit f26f4a7e01
72 changed files with 8875 additions and 2323 deletions

View file

@ -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)

View file

@ -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})
}