228 lines
5.4 KiB
JSON
228 lines
5.4 KiB
JSON
|
|
{
|
||
|
|
"openapi": "3.0.0",
|
||
|
|
"info": {
|
||
|
|
"title": "Test API",
|
||
|
|
"version": "1.0.0",
|
||
|
|
"description": "API для тестирования генератора"
|
||
|
|
},
|
||
|
|
"servers": [
|
||
|
|
{
|
||
|
|
"url": "https://api.example.com"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"paths": {
|
||
|
|
"/users": {
|
||
|
|
"get": {
|
||
|
|
"operationId": "UserController_getAll",
|
||
|
|
"summary": "Получить всех пользователей",
|
||
|
|
"parameters": [
|
||
|
|
{
|
||
|
|
"name": "page",
|
||
|
|
"in": "query",
|
||
|
|
"schema": {
|
||
|
|
"type": "integer",
|
||
|
|
"default": 1
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "limit",
|
||
|
|
"in": "query",
|
||
|
|
"schema": {
|
||
|
|
"type": "integer",
|
||
|
|
"default": 10
|
||
|
|
}
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "Список пользователей",
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"$ref": "#/components/schemas/User"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"post": {
|
||
|
|
"operationId": "UserController_create",
|
||
|
|
"summary": "Создать пользователя",
|
||
|
|
"requestBody": {
|
||
|
|
"required": true,
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/components/schemas/CreateUserDto"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"responses": {
|
||
|
|
"201": {
|
||
|
|
"description": "Пользователь создан",
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/components/schemas/User"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"400": {
|
||
|
|
"description": "Ошибка валидации"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"/users/{id}": {
|
||
|
|
"get": {
|
||
|
|
"operationId": "UserController_getById",
|
||
|
|
"summary": "Получить пользователя по ID",
|
||
|
|
"parameters": [
|
||
|
|
{
|
||
|
|
"name": "id",
|
||
|
|
"in": "path",
|
||
|
|
"required": true,
|
||
|
|
"schema": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "Пользователь найден",
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/components/schemas/User"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"404": {
|
||
|
|
"description": "Пользователь не найден"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"patch": {
|
||
|
|
"operationId": "UserController_update",
|
||
|
|
"summary": "Обновить пользователя",
|
||
|
|
"parameters": [
|
||
|
|
{
|
||
|
|
"name": "id",
|
||
|
|
"in": "path",
|
||
|
|
"required": true,
|
||
|
|
"schema": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"requestBody": {
|
||
|
|
"required": true,
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/components/schemas/UpdateUserDto"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "Пользователь обновлен",
|
||
|
|
"content": {
|
||
|
|
"application/json": {
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/components/schemas/User"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"delete": {
|
||
|
|
"operationId": "UserController_delete",
|
||
|
|
"summary": "Удалить пользователя",
|
||
|
|
"parameters": [
|
||
|
|
{
|
||
|
|
"name": "id",
|
||
|
|
"in": "path",
|
||
|
|
"required": true,
|
||
|
|
"schema": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"responses": {
|
||
|
|
"204": {
|
||
|
|
"description": "Пользователь удален"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"components": {
|
||
|
|
"schemas": {
|
||
|
|
"User": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"id": {
|
||
|
|
"type": "string",
|
||
|
|
"example": "123"
|
||
|
|
},
|
||
|
|
"email": {
|
||
|
|
"type": "string",
|
||
|
|
"example": "user@example.com"
|
||
|
|
},
|
||
|
|
"name": {
|
||
|
|
"type": "string",
|
||
|
|
"example": "John Doe"
|
||
|
|
},
|
||
|
|
"role": {
|
||
|
|
"$ref": "#/components/schemas/UserRole"
|
||
|
|
},
|
||
|
|
"createdAt": {
|
||
|
|
"type": "string",
|
||
|
|
"format": "date-time"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"required": ["id", "email", "role"]
|
||
|
|
},
|
||
|
|
"CreateUserDto": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"email": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"name": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"password": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"required": ["email", "password"]
|
||
|
|
},
|
||
|
|
"UpdateUserDto": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"name": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"email": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"UserRole": {
|
||
|
|
"type": "string",
|
||
|
|
"enum": ["admin", "user", "guest"]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|