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 // @Summary Create/Update a message
// @Accept json // @Accept json
// @Produce 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 // @Success 200 {object} config.Message
// @Router /message [post] // @Router /message [post]
func (b *API) handlePostMessage(c echo.Context) error { func (b *API) handlePostMessage(c echo.Context) error {
@ -132,7 +132,7 @@ func (b *API) handlePostMessage(c echo.Context) error {
} }
// handleMessages godoc // handleMessages godoc
// @Summary List of new messages // @Summary List new messages
// @Produce json // @Produce json
// @Success 200 {array} config.Message // @Success 200 {array} config.Message
// @Router /messages [get] // @Router /messages [get]
@ -145,7 +145,7 @@ func (b *API) handleMessages(c echo.Context) error {
} }
// handleStream godoc // handleStream godoc
// @Summary Streams realtime messages // @Summary Stream realtime messages
// @Produce json-stream // @Produce json-stream
// @Success 200 {object} config.Message // @Success 200 {object} config.Message
// @Router /stream [get] // @Router /stream [get]

View File

@ -37,7 +37,7 @@ type Message struct {
UserID string `json:"userid" example:"U4MCXJKNC"` UserID string `json:"userid" example:"U4MCXJKNC"`
// URL to an avatar image // URL to an avatar image
Avatar string `json:"avatar" example:"https://secure.gravatar.com/avatar/1234567890abcdef1234567890abcdef.jpg"` 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"` Account string `json:"account" example:"slack.myteam"`
// Can be blank. // Can be blank.
Event string `json:"event" example:""` Event string `json:"event" example:""`

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-05 04:31:47.316226 +0800 CST m=+0.167027083 // 2018-11-05 15:12:37.21158 +0800 CST m=+0.084936216
package docs package docs
@ -33,11 +33,12 @@ var doc = `{
"parameters": [ "parameters": [
{ {
"description": "Message object to create", "description": "Message object to create",
"name": "body", "name": "message",
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"type": "object" "type": "object",
"$ref": "#/definitions/config.Message"
} }
} }
], ],
@ -57,7 +58,7 @@ var doc = `{
"produces": [ "produces": [
"application/json" "application/json"
], ],
"summary": "List of new messages", "summary": "List new messages",
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -76,7 +77,7 @@ var doc = `{
"produces": [ "produces": [
"application/x-json-stream" "application/x-json-stream"
], ],
"summary": "Streams realtime messages", "summary": "Stream realtime messages",
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -94,7 +95,7 @@ var doc = `{
"type": "object", "type": "object",
"properties": { "properties": {
"account": { "account": {
"description": "Unique account name of format \"\u003cprotocol\u003e.\u003cslug\u003e\"\n", "description": "Unique account name of format \"[protocol].[slug]\"\n",
"type": "string", "type": "string",
"example": "slack.myteam" "example": "slack.myteam"
}, },

View File

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

View File

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