swagger docs update

This commit is contained in:
nquidox 2025-09-12 23:54:56 +03:00
parent 06d952c145
commit f07131264f
3 changed files with 53 additions and 40 deletions

View file

@ -104,11 +104,6 @@ const docTemplate = `{
} }
}, },
"post": { "post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Регистрация нового пользователя", "description": "Регистрация нового пользователя",
"consumes": [ "consumes": [
"application/json" "application/json"
@ -182,13 +177,8 @@ const docTemplate = `{
} }
} }
}, },
"/user/login": { "/user/auth/login": {
"post": { "post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Логин", "description": "Логин",
"consumes": [ "consumes": [
"application/json" "application/json"
@ -210,7 +200,10 @@ const docTemplate = `{
], ],
"responses": { "responses": {
"200": { "200": {
"description": "OK" "description": "OK",
"schema": {
"$ref": "#/definitions/user.LoginResponse"
}
}, },
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
@ -227,14 +220,14 @@ const docTemplate = `{
} }
} }
}, },
"/user/logout": { "/user/auth/logout": {
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "BearerAuth": []
} }
], ],
"description": "Логаут. Uuid юзера будет извлечен из токена.", "description": "Логаут. Для логаута надо передать refresh token, он будет инвалидирован.",
"tags": [ "tags": [
"Users - auth" "Users - auth"
], ],
@ -258,7 +251,7 @@ const docTemplate = `{
} }
} }
}, },
"/user/refresh": { "/user/auth/refresh": {
"post": { "post": {
"security": [ "security": [
{ {
@ -272,7 +265,10 @@ const docTemplate = `{
"summary": "Обновление аксесс токена по рефреш токену.", "summary": "Обновление аксесс токена по рефреш токену.",
"responses": { "responses": {
"200": { "200": {
"description": "OK" "description": "OK",
"schema": {
"$ref": "#/definitions/user.LoginResponse"
}
}, },
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
@ -343,6 +339,14 @@ const docTemplate = `{
} }
} }
}, },
"user.LoginResponse": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
}
}
},
"user.Register": { "user.Register": {
"type": "object", "type": "object",
"properties": { "properties": {

View file

@ -96,11 +96,6 @@
} }
}, },
"post": { "post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Регистрация нового пользователя", "description": "Регистрация нового пользователя",
"consumes": [ "consumes": [
"application/json" "application/json"
@ -174,13 +169,8 @@
} }
} }
}, },
"/user/login": { "/user/auth/login": {
"post": { "post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Логин", "description": "Логин",
"consumes": [ "consumes": [
"application/json" "application/json"
@ -202,7 +192,10 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "OK" "description": "OK",
"schema": {
"$ref": "#/definitions/user.LoginResponse"
}
}, },
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
@ -219,14 +212,14 @@
} }
} }
}, },
"/user/logout": { "/user/auth/logout": {
"post": { "post": {
"security": [ "security": [
{ {
"BearerAuth": [] "BearerAuth": []
} }
], ],
"description": "Логаут. Uuid юзера будет извлечен из токена.", "description": "Логаут. Для логаута надо передать refresh token, он будет инвалидирован.",
"tags": [ "tags": [
"Users - auth" "Users - auth"
], ],
@ -250,7 +243,7 @@
} }
} }
}, },
"/user/refresh": { "/user/auth/refresh": {
"post": { "post": {
"security": [ "security": [
{ {
@ -264,7 +257,10 @@
"summary": "Обновление аксесс токена по рефреш токену.", "summary": "Обновление аксесс токена по рефреш токену.",
"responses": { "responses": {
"200": { "200": {
"description": "OK" "description": "OK",
"schema": {
"$ref": "#/definitions/user.LoginResponse"
}
}, },
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
@ -335,6 +331,14 @@
} }
} }
}, },
"user.LoginResponse": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
}
}
},
"user.Register": { "user.Register": {
"type": "object", "type": "object",
"properties": { "properties": {

View file

@ -34,6 +34,11 @@ definitions:
password: password:
type: string type: string
type: object type: object
user.LoginResponse:
properties:
access_token:
type: string
type: object
user.Register: user.Register:
properties: properties:
email: email:
@ -124,8 +129,6 @@ paths:
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/responses.ErrorResponse500' $ref: '#/definitions/responses.ErrorResponse500'
security:
- BearerAuth: []
summary: Регистрация нового пользователя summary: Регистрация нового пользователя
tags: tags:
- Users - Users
@ -160,7 +163,7 @@ paths:
summary: Обновить информацию о пользователе summary: Обновить информацию о пользователе
tags: tags:
- Users - Users
/user/login: /user/auth/login:
post: post:
consumes: consumes:
- application/json - application/json
@ -175,6 +178,8 @@ paths:
responses: responses:
"200": "200":
description: OK description: OK
schema:
$ref: '#/definitions/user.LoginResponse'
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
@ -183,14 +188,12 @@ paths:
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/responses.ErrorResponse500' $ref: '#/definitions/responses.ErrorResponse500'
security:
- BearerAuth: []
summary: Логин summary: Логин
tags: tags:
- Users - auth - Users - auth
/user/logout: /user/auth/logout:
post: post:
description: Логаут. Uuid юзера будет извлечен из токена. description: Логаут. Для логаута надо передать refresh token, он будет инвалидирован.
responses: responses:
"200": "200":
description: OK description: OK
@ -207,12 +210,14 @@ paths:
summary: Логаут summary: Логаут
tags: tags:
- Users - auth - Users - auth
/user/refresh: /user/auth/refresh:
post: post:
description: Принимает рефреш токен в заголовке Authorization description: Принимает рефреш токен в заголовке Authorization
responses: responses:
"200": "200":
description: OK description: OK
schema:
$ref: '#/definitions/user.LoginResponse'
"400": "400":
description: Bad Request description: Bad Request
schema: schema: