From e873280794a8383ddc0ee50027488ec5b219a932 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 5 Nov 2018 15:12:30 +0800 Subject: [PATCH] Fixed up Swagger formatting. --- bridge/api/api.go | 6 +++--- bridge/config/config.go | 2 +- docs/docs.go | 13 +++++++------ docs/swagger/swagger.json | 11 ++++++----- docs/swagger/swagger.yaml | 9 +++++---- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/bridge/api/api.go b/bridge/api/api.go index ce575c79..3d9369c0 100644 --- a/bridge/api/api.go +++ b/bridge/api/api.go @@ -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] diff --git a/bridge/config/config.go b/bridge/config/config.go index 92168722..e328f2eb 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -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 "." + // Unique account name of format "[protocol].[slug]" Account string `json:"account" example:"slack.myteam"` // Can be blank. Event string `json:"event" example:""` diff --git a/docs/docs.go b/docs/docs.go index 5511ee31..d1021be6 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -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" }, diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index e78e175f..4d516f66 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -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" }, diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index cced4174..63c67e64 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -4,7 +4,7 @@ definitions: properties: account: description: | - Unique account name of format "." + 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