feat: add API versioning , translate swagger, remove rate limiter
This commit is contained in:
+98
-77
@@ -4,15 +4,16 @@
|
||||
],
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "API for AegisGuard control plane",
|
||||
"description": "API системы управления AegisGuard. Позволяет управлять пользователями и организациями.\nВсе защищённые эндпоинты требуют заголовок `Authorization: Bearer \u003ctoken\u003e`.\nТокен получается при регистрации или входе.",
|
||||
"title": "AegisGuard API",
|
||||
"contact": {},
|
||||
"version": "1.0"
|
||||
},
|
||||
"basePath": "/api/v1",
|
||||
"paths": {
|
||||
"/api/auth/login": {
|
||||
"/api/v1/auth/login": {
|
||||
"post": {
|
||||
"description": "Authenticate user with email and password, returns JWT token",
|
||||
"description": "Аутентификация по email и паролю. Возвращает access_token (JWT) и refresh_token.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -22,10 +23,10 @@
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Login",
|
||||
"summary": "Вход",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Login credentials",
|
||||
"description": "Email и пароль",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -36,19 +37,19 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Успешный вход, токены в ответе",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Ошибка валидации полей",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"description": "Неверный email или пароль",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
@@ -56,9 +57,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/logout": {
|
||||
"/api/v1/auth/logout": {
|
||||
"post": {
|
||||
"description": "Invalidate a refresh token (logout)",
|
||||
"description": "Аннулирование refresh_token. После выхода повторное использование того же refresh_token вернёт 401.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -68,10 +69,10 @@
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Logout",
|
||||
"summary": "Выход",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Refresh token to invalidate",
|
||||
"description": "Refresh_token для аннулирования",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -82,7 +83,7 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "{\"message\": \"logged out successfully\"}",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
@@ -91,13 +92,13 @@
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Не указан refresh_token",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"description": "Refresh_token не найден или уже аннулирован",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
@@ -105,14 +106,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/me": {
|
||||
"/api/v1/auth/me": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Get authenticated user's profile",
|
||||
"description": "Получение профиля текущего авторизованного пользователя.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -122,16 +123,16 @@
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Get current user",
|
||||
"summary": "Профиль пользователя",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Данные пользователя",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.UserResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"description": "Токен не указан или недействителен",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
@@ -144,7 +145,7 @@
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Update current user's username",
|
||||
"description": "Обновление username текущего пользователя.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -154,10 +155,10 @@
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Update profile",
|
||||
"summary": "Обновление профиля",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Profile update",
|
||||
"description": "Новый username",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -168,19 +169,19 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Обновлённый профиль",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Ошибка валидации: username от 3 до 30 символов",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"description": "Токен не указан или недействителен",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
@@ -188,14 +189,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/password": {
|
||||
"/api/v1/auth/password": {
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Change current user's password",
|
||||
"description": "Изменение пароля текущего пользователя. Требуется указать старый и новый пароль.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.\nПароль должен содержать минимум 8 символов, заглавную букву, строчную букву и цифру.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -205,10 +206,10 @@
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Change password",
|
||||
"summary": "Смена пароля",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Password change details",
|
||||
"description": "Старый и новый пароль",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -219,7 +220,7 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "{\"message\": \"password changed successfully\"}",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
@@ -228,13 +229,13 @@
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Ошибка валидации: неверный старый пароль, слабый новый или совпадают",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"description": "Токен не указан или недействителен",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
@@ -242,9 +243,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/refresh": {
|
||||
"/api/v1/auth/refresh": {
|
||||
"post": {
|
||||
"description": "Get a new access token using a refresh token",
|
||||
"description": "Получение новой пары токенов по refresh_token. Старый refresh_token становится недействительным (ротация).\nЕсли refresh_token истёк или уже был использован — придёт 401.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -254,10 +255,10 @@
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Refresh token",
|
||||
"summary": "Обновление токенов",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Refresh token",
|
||||
"description": "Действительный refresh_token",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -268,19 +269,19 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Новая пара токенов",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Не указан refresh_token",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"description": "Refresh_token недействителен или истёк",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
@@ -288,9 +289,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/register": {
|
||||
"/api/v1/auth/register": {
|
||||
"post": {
|
||||
"description": "Create user account with username, email, password",
|
||||
"description": "Создание новой учётной записи. После успешной регистрации сразу возвращается access_token и refresh_token.\nПароль должен содержать минимум 8 символов, заглавную букву, строчную букву и цифру.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -300,10 +301,10 @@
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Register",
|
||||
"summary": "Регистрация",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Registration details",
|
||||
"description": "Данные для регистрации",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -314,19 +315,19 @@
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"description": "Пользователь создан, токены в ответе",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Ошибка валидации полей (некорректный email, слабый пароль)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"description": "Email уже зарегистрирован",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
@@ -334,14 +335,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/organizations": {
|
||||
"/api/v1/organizations": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Get all organizations",
|
||||
"description": "Получение списка всех организаций с пагинацией.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -351,16 +352,30 @@
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "List organizations",
|
||||
"summary": "Список организаций",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Количество записей на странице (по умолчанию 20)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Смещение от начала списка (по умолчанию 0)",
|
||||
"name": "offset",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Список организаций",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgListResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"description": "Внутренняя ошибка сервера",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
@@ -373,7 +388,7 @@
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Create a new organization",
|
||||
"description": "Создание новой организации. slug используется в URL и должен быть уникальным.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -383,10 +398,10 @@
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Create organization",
|
||||
"summary": "Создание организации",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Organization details",
|
||||
"description": "Название и slug организации",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -397,19 +412,19 @@
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"description": "Организация создана",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Ошибка валидации полей",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"description": "Slug уже занят",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
@@ -417,14 +432,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/organizations/{id}": {
|
||||
"/api/v1/organizations/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Get organization details",
|
||||
"description": "Получение информации об организации по её ID.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -434,11 +449,11 @@
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Get organization by ID",
|
||||
"summary": "Получить организацию",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Organization ID",
|
||||
"description": "UUID организации",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -446,13 +461,13 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Данные организации",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"description": "Организация не найдена",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
@@ -465,7 +480,7 @@
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Update organization name",
|
||||
"description": "Обновление названия организации. slug изменить нельзя.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -475,17 +490,17 @@
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Update organization",
|
||||
"summary": "Обновление организации",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Organization ID",
|
||||
"description": "UUID организации",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "New organization details",
|
||||
"description": "Новое название организации",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -496,19 +511,19 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Обновлённая организация",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"description": "Ошибка валидации полей",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"description": "Организация не найдена",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
@@ -521,7 +536,7 @@
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Delete an organization",
|
||||
"description": "Безвозвратное удаление организации по её ID.\n**Требуется:** заголовок `Authorization: Bearer \u003ctoken\u003e`.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -531,11 +546,11 @@
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Delete organization",
|
||||
"summary": "Удаление организации",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Organization ID",
|
||||
"description": "UUID организации",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -543,7 +558,7 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "{\"message\": \"organization deleted\"}",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
@@ -552,7 +567,7 @@
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"description": "Организация не найдена",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
@@ -742,6 +757,12 @@
|
||||
"org.OrgListResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer"
|
||||
},
|
||||
"organizations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -798,7 +819,7 @@
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"Bearer": {
|
||||
"description": "Type \"Bearer\" followed by a space and the JWT token.",
|
||||
"description": "Введите `Bearer \u003ctoken\u003e`, где token — access_token из ответа /auth/login или /auth/register",
|
||||
"type": "apiKey",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
|
||||
Reference in New Issue
Block a user