From 47a0143d1ae67bb2b5e15dc6cbc1f8472f274a5c Mon Sep 17 00:00:00 2001 From: Monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:16:41 +0330 Subject: [PATCH] fix: swagger document response type (#932) --- docs/swagger/docs.go | 24 ++++++++++++------------ docs/swagger/swagger.json | 24 ++++++++++++------------ docs/swagger/swagger.yaml | 16 ++++++++-------- internal/http/routes/api/v1/bookmarks.go | 2 +- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 42c54ca5e..33a8c5649 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -172,7 +172,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/api_v1.contentResponseMessage" + "$ref": "#/definitions/api_v1.readableResponseMessage" } }, "403": { @@ -228,17 +228,6 @@ const docTemplate = `{ } }, "definitions": { - "api_v1.contentResponseMessage": { - "type": "object", - "properties": { - "content": { - "type": "string" - }, - "html": { - "type": "string" - } - } - }, "api_v1.loginRequestPayload": { "type": "object", "required": [ @@ -273,6 +262,17 @@ const docTemplate = `{ } } }, + "api_v1.readableResponseMessage": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "html": { + "type": "string" + } + } + }, "api_v1.settingRequestPayload": { "type": "object", "properties": { diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index 251e02b42..76754913e 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -161,7 +161,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/api_v1.contentResponseMessage" + "$ref": "#/definitions/api_v1.readableResponseMessage" } }, "403": { @@ -217,17 +217,6 @@ } }, "definitions": { - "api_v1.contentResponseMessage": { - "type": "object", - "properties": { - "content": { - "type": "string" - }, - "html": { - "type": "string" - } - } - }, "api_v1.loginRequestPayload": { "type": "object", "required": [ @@ -262,6 +251,17 @@ } } }, + "api_v1.readableResponseMessage": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "html": { + "type": "string" + } + } + }, "api_v1.settingRequestPayload": { "type": "object", "properties": { diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 0ce37a25c..67344b457 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1,11 +1,4 @@ definitions: - api_v1.contentResponseMessage: - properties: - content: - type: string - html: - type: string - type: object api_v1.loginRequestPayload: properties: password: @@ -29,6 +22,13 @@ definitions: token: type: string type: object + api_v1.readableResponseMessage: + properties: + content: + type: string + html: + type: string + type: object api_v1.settingRequestPayload: properties: config: @@ -233,7 +233,7 @@ paths: "200": description: OK schema: - $ref: '#/definitions/api_v1.contentResponseMessage' + $ref: '#/definitions/api_v1.readableResponseMessage' "403": description: Token not provided/invalid summary: Get readable version of bookmark. diff --git a/internal/http/routes/api/v1/bookmarks.go b/internal/http/routes/api/v1/bookmarks.go index f1a97ed88..0d70194ae 100644 --- a/internal/http/routes/api/v1/bookmarks.go +++ b/internal/http/routes/api/v1/bookmarks.go @@ -97,7 +97,7 @@ type readableResponseMessage struct { // @Tags Auth // @securityDefinitions.apikey ApiKeyAuth // @Produce json -// @Success 200 {object} contentResponseMessage +// @Success 200 {object} readableResponseMessage // @Failure 403 {object} nil "Token not provided/invalid" // @Router /api/v1/bookmarks/id/readable [get] func (r *BookmarksAPIRoutes) bookmarkReadable(c *gin.Context) {