Fixed API description docs.

This commit is contained in:
Patrick Connolly
2018-11-29 04:32:58 +08:00
parent 77a932edb8
commit cdc942d676
4 changed files with 12 additions and 10 deletions

View File

@@ -9,15 +9,14 @@ import (
"github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/config"
_ "github.com/42wim/matterbridge/docs"
"github.com/labstack/echo" "github.com/labstack/echo"
"github.com/labstack/echo/middleware" "github.com/labstack/echo/middleware"
"github.com/swaggo/echo-swagger" "github.com/swaggo/echo-swagger"
"github.com/zfjagann/golang-ring" "github.com/zfjagann/golang-ring"
_ "github.com/42wim/matterbridge/docs"
) )
// @title Matterbridge API // @title Matterbridge API
// @description A read/write API for the Matterbridge chat bridge.
// @license.name Apache 2.0 // @license.name Apache 2.0
// @license.url https://github.com/42wim/matterbridge/blob/master/LICENSE // @license.url https://github.com/42wim/matterbridge/blob/master/LICENSE
@@ -110,7 +109,6 @@ func (b *API) Send(msg config.Message) (string, error) {
// handleHealthcheck godoc // handleHealthcheck godoc
// @Summary Checks if the server is alive. // @Summary Checks if the server is alive.
// @Description OK
// @Success 200 {string} string // @Success 200 {string} string
// @Router /health [get] // @Router /health [get]
func (b *API) handleHealthcheck(c echo.Context) error { func (b *API) handleHealthcheck(c echo.Context) error {
@@ -122,6 +120,7 @@ func (b *API) handleDocsRedirect(c echo.Context) error {
} }
// handlePostMessage godoc // handlePostMessage godoc
// @Description Required fields: text, gateway. Optional fields: username, avatar.
// @Summary Create/Update a message // @Summary Create/Update a message
// @Accept json // @Accept json
// @Produce json // @Produce json
@@ -193,3 +192,6 @@ func (b *API) handleStream(c echo.Context) error {
} }
} }
} }
// Must go at the bottom due to bug where endpoint descriptions override.
// @description A read/write API for the Matterbridge chat bridge.

View File

@@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at // This file was generated by swaggo/swag at
// 2018-11-29 03:59:40.172197 +0800 CST m=+0.084842487 // 2018-11-29 04:32:21.768173 +0800 CST m=+0.082341511
package docs package docs
@@ -11,7 +11,7 @@ import (
var doc = `{ var doc = `{
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "OK", "description": "A read/write API for the Matterbridge chat bridge.",
"title": "Matterbridge API", "title": "Matterbridge API",
"contact": {}, "contact": {},
"license": { "license": {
@@ -23,7 +23,6 @@ var doc = `{
"paths": { "paths": {
"/health": { "/health": {
"get": { "get": {
"description": "OK",
"summary": "Checks if the server is alive.", "summary": "Checks if the server is alive.",
"responses": { "responses": {
"200": { "200": {
@@ -42,6 +41,7 @@ var doc = `{
"ApiKeyAuth": [] "ApiKeyAuth": []
} }
], ],
"description": "Required fields: text, gateway. Optional fields: username, avatar.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],

View File

@@ -1,7 +1,7 @@
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "OK", "description": "A read/write API for the Matterbridge chat bridge.",
"title": "Matterbridge API", "title": "Matterbridge API",
"contact": {}, "contact": {},
"license": { "license": {
@@ -13,7 +13,6 @@
"paths": { "paths": {
"/health": { "/health": {
"get": { "get": {
"description": "OK",
"summary": "Checks if the server is alive.", "summary": "Checks if the server is alive.",
"responses": { "responses": {
"200": { "200": {
@@ -32,6 +31,7 @@
"ApiKeyAuth": [] "ApiKeyAuth": []
} }
], ],
"description": "Required fields: text, gateway. Optional fields: username, avatar.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],

View File

@@ -65,7 +65,7 @@ definitions:
type: object type: object
info: info:
contact: {} contact: {}
description: OK description: A read/write API for the Matterbridge chat bridge.
license: license:
name: Apache 2.0 name: Apache 2.0
url: https://github.com/42wim/matterbridge/blob/master/LICENSE url: https://github.com/42wim/matterbridge/blob/master/LICENSE
@@ -73,7 +73,6 @@ info:
paths: paths:
/health: /health:
get: get:
description: OK
responses: responses:
"200": "200":
description: OK description: OK
@@ -84,6 +83,7 @@ paths:
post: post:
consumes: consumes:
- application/json - application/json
description: 'Required fields: text, gateway. Optional fields: username, avatar.'
parameters: parameters:
- description: Message object to create - description: Message object to create
in: body in: body