Fixed up Swagger formatting.

This commit is contained in:
Patrick Connolly 2018-11-05 15:12:30 +08:00
parent b855dc8ec5
commit e873280794
5 changed files with 22 additions and 19 deletions

View File

@ -112,7 +112,7 @@ func (b *Api) handleDocsRedirect(c echo.Context) error {
// @Summary Create/Update a message
// @Accept json
// @Produce json
// @Param body body object true "Message object to create"
// @Param message body config.Message true "Message object to create"
// @Success 200 {object} config.Message
// @Router /message [post]
func (b *API) handlePostMessage(c echo.Context) error {
@ -132,7 +132,7 @@ func (b *API) handlePostMessage(c echo.Context) error {
}
// handleMessages godoc
// @Summary List of new messages
// @Summary List new messages
// @Produce json
// @Success 200 {array} config.Message
// @Router /messages [get]
@ -145,7 +145,7 @@ func (b *API) handleMessages(c echo.Context) error {
}
// handleStream godoc
// @Summary Streams realtime messages
// @Summary Stream realtime messages
// @Produce json-stream
// @Success 200 {object} config.Message
// @Router /stream [get]

View File

@ -37,7 +37,7 @@ type Message struct {
UserID string `json:"userid" example:"U4MCXJKNC"`
// URL to an avatar image
Avatar string `json:"avatar" example:"https://secure.gravatar.com/avatar/1234567890abcdef1234567890abcdef.jpg"`
// Unique account name of format "<protocol>.<slug>"
// Unique account name of format "[protocol].[slug]"
Account string `json:"account" example:"slack.myteam"`
// Can be blank.
Event string `json:"event" example:""`

View File

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2018-11-05 04:31:47.316226 +0800 CST m=+0.167027083
// 2018-11-05 15:12:37.21158 +0800 CST m=+0.084936216
package docs
@ -33,11 +33,12 @@ var doc = `{
"parameters": [
{
"description": "Message object to create",
"name": "body",
"name": "message",
"in": "body",
"required": true,
"schema": {
"type": "object"
"type": "object",
"$ref": "#/definitions/config.Message"
}
}
],
@ -57,7 +58,7 @@ var doc = `{
"produces": [
"application/json"
],
"summary": "List of new messages",
"summary": "List new messages",
"responses": {
"200": {
"description": "OK",
@ -76,7 +77,7 @@ var doc = `{
"produces": [
"application/x-json-stream"
],
"summary": "Streams realtime messages",
"summary": "Stream realtime messages",
"responses": {
"200": {
"description": "OK",
@ -94,7 +95,7 @@ var doc = `{
"type": "object",
"properties": {
"account": {
"description": "Unique account name of format \"\u003cprotocol\u003e.\u003cslug\u003e\"\n",
"description": "Unique account name of format \"[protocol].[slug]\"\n",
"type": "string",
"example": "slack.myteam"
},

View File

@ -23,11 +23,12 @@
"parameters": [
{
"description": "Message object to create",
"name": "body",
"name": "message",
"in": "body",
"required": true,
"schema": {
"type": "object"
"type": "object",
"$ref": "#/definitions/config.Message"
}
}
],
@ -47,7 +48,7 @@
"produces": [
"application/json"
],
"summary": "List of new messages",
"summary": "List new messages",
"responses": {
"200": {
"description": "OK",
@ -66,7 +67,7 @@
"produces": [
"application/x-json-stream"
],
"summary": "Streams realtime messages",
"summary": "Stream realtime messages",
"responses": {
"200": {
"description": "OK",
@ -84,7 +85,7 @@
"type": "object",
"properties": {
"account": {
"description": "Unique account name of format \"\u003cprotocol\u003e.\u003cslug\u003e\"\n",
"description": "Unique account name of format \"[protocol].[slug]\"\n",
"type": "string",
"example": "slack.myteam"
},

View File

@ -4,7 +4,7 @@ definitions:
properties:
account:
description: |
Unique account name of format "<protocol>.<slug>"
Unique account name of format "[protocol].[slug]"
example: slack.myteam
type: string
avatar:
@ -74,9 +74,10 @@ paths:
parameters:
- description: Message object to create
in: body
name: body
name: message
required: true
schema:
$ref: '#/definitions/config.Message'
type: object
produces:
- application/json
@ -98,7 +99,7 @@ paths:
items:
$ref: '#/definitions/config.Message'
type: array
summary: List of new messages
summary: List new messages
/stream:
get:
produces:
@ -109,7 +110,7 @@ paths:
schema:
$ref: '#/definitions/config.Message'
type: object
summary: Streams realtime messages
summary: Stream realtime messages
securityDefinitions:
"":
in: header