From f07131264f2a8a3629c1cd68a64e178d0cb90b5c Mon Sep 17 00:00:00 2001 From: nquidox Date: Fri, 12 Sep 2025 23:54:56 +0300 Subject: [PATCH] swagger docs update --- docs/docs.go | 36 ++++++++++++++++++++---------------- docs/swagger.json | 36 ++++++++++++++++++++---------------- docs/swagger.yaml | 21 +++++++++++++-------- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 227209c..c9efd1c 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -104,11 +104,6 @@ const docTemplate = `{ } }, "post": { - "security": [ - { - "BearerAuth": [] - } - ], "description": "Регистрация нового пользователя", "consumes": [ "application/json" @@ -182,13 +177,8 @@ const docTemplate = `{ } } }, - "/user/login": { + "/user/auth/login": { "post": { - "security": [ - { - "BearerAuth": [] - } - ], "description": "Логин", "consumes": [ "application/json" @@ -210,7 +200,10 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "schema": { + "$ref": "#/definitions/user.LoginResponse" + } }, "400": { "description": "Bad Request", @@ -227,14 +220,14 @@ const docTemplate = `{ } } }, - "/user/logout": { + "/user/auth/logout": { "post": { "security": [ { "BearerAuth": [] } ], - "description": "Логаут. Uuid юзера будет извлечен из токена.", + "description": "Логаут. Для логаута надо передать refresh token, он будет инвалидирован.", "tags": [ "Users - auth" ], @@ -258,7 +251,7 @@ const docTemplate = `{ } } }, - "/user/refresh": { + "/user/auth/refresh": { "post": { "security": [ { @@ -272,7 +265,10 @@ const docTemplate = `{ "summary": "Обновление аксесс токена по рефреш токену.", "responses": { "200": { - "description": "OK" + "description": "OK", + "schema": { + "$ref": "#/definitions/user.LoginResponse" + } }, "400": { "description": "Bad Request", @@ -343,6 +339,14 @@ const docTemplate = `{ } } }, + "user.LoginResponse": { + "type": "object", + "properties": { + "access_token": { + "type": "string" + } + } + }, "user.Register": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 91af47a..f8b76d8 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -96,11 +96,6 @@ } }, "post": { - "security": [ - { - "BearerAuth": [] - } - ], "description": "Регистрация нового пользователя", "consumes": [ "application/json" @@ -174,13 +169,8 @@ } } }, - "/user/login": { + "/user/auth/login": { "post": { - "security": [ - { - "BearerAuth": [] - } - ], "description": "Логин", "consumes": [ "application/json" @@ -202,7 +192,10 @@ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "schema": { + "$ref": "#/definitions/user.LoginResponse" + } }, "400": { "description": "Bad Request", @@ -219,14 +212,14 @@ } } }, - "/user/logout": { + "/user/auth/logout": { "post": { "security": [ { "BearerAuth": [] } ], - "description": "Логаут. Uuid юзера будет извлечен из токена.", + "description": "Логаут. Для логаута надо передать refresh token, он будет инвалидирован.", "tags": [ "Users - auth" ], @@ -250,7 +243,7 @@ } } }, - "/user/refresh": { + "/user/auth/refresh": { "post": { "security": [ { @@ -264,7 +257,10 @@ "summary": "Обновление аксесс токена по рефреш токену.", "responses": { "200": { - "description": "OK" + "description": "OK", + "schema": { + "$ref": "#/definitions/user.LoginResponse" + } }, "400": { "description": "Bad Request", @@ -335,6 +331,14 @@ } } }, + "user.LoginResponse": { + "type": "object", + "properties": { + "access_token": { + "type": "string" + } + } + }, "user.Register": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2ea8ca5..4186456 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -34,6 +34,11 @@ definitions: password: type: string type: object + user.LoginResponse: + properties: + access_token: + type: string + type: object user.Register: properties: email: @@ -124,8 +129,6 @@ paths: description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse500' - security: - - BearerAuth: [] summary: Регистрация нового пользователя tags: - Users @@ -160,7 +163,7 @@ paths: summary: Обновить информацию о пользователе tags: - Users - /user/login: + /user/auth/login: post: consumes: - application/json @@ -175,6 +178,8 @@ paths: responses: "200": description: OK + schema: + $ref: '#/definitions/user.LoginResponse' "400": description: Bad Request schema: @@ -183,14 +188,12 @@ paths: description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse500' - security: - - BearerAuth: [] summary: Логин tags: - Users - auth - /user/logout: + /user/auth/logout: post: - description: Логаут. Uuid юзера будет извлечен из токена. + description: Логаут. Для логаута надо передать refresh token, он будет инвалидирован. responses: "200": description: OK @@ -207,12 +210,14 @@ paths: summary: Логаут tags: - Users - auth - /user/refresh: + /user/auth/refresh: post: description: Принимает рефреш токен в заголовке Authorization responses: "200": description: OK + schema: + $ref: '#/definitions/user.LoginResponse' "400": description: Bad Request schema: