feat: added openapi doc
All checks were successful
Test / lint-frontend (pull_request) Successful in 45s
Test / test-frontend (pull_request) Successful in 44s
Test / frontend-build (pull_request) Successful in 47s
Verify / verify-generated-agent-code (pull_request) Successful in 1m15s
Verify / verify-openapi-spec (pull_request) Successful in 2m29s
Verify / verify-generated-database-code (pull_request) Successful in 2m35s
Verify / verify-frontend-api-client (pull_request) Successful in 19s
Test / lint-crates (pull_request) Successful in 59s
Test / test-crates (pull_request) Successful in 2m44s

This commit is contained in:
GW_MC
2025-12-31 16:44:18 +08:00
parent 6a30a03e59
commit d184261027
12 changed files with 1422 additions and 10 deletions

View File

@@ -106,6 +106,357 @@
}
}
},
"/api/upstream_targets/{upstream_target_id}": {
"get": {
"tags": [
"Nginx"
],
"operationId": "get_upstream_target",
"parameters": [
{
"name": "upstream_target_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Get upstream target info",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpstreamTargetInfo"
}
}
}
},
"404": {
"description": "Not found"
},
"500": {
"description": "Internal server error"
}
}
},
"delete": {
"tags": [
"Nginx"
],
"operationId": "remove_upstream_target",
"parameters": [
{
"name": "upstream_target_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Upstream target removed successfully",
"content": {
"application/json": {
"schema": {
"default": null
}
}
}
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Not found"
},
"500": {
"description": "Internal server error"
}
}
},
"patch": {
"tags": [
"Nginx"
],
"operationId": "update_upstream_target",
"parameters": [
{
"name": "upstream_target_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateUpstreamTargetRequestBody"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Upstream target updated successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateUpstreamTargetInfoResponse"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Not found"
},
"422": {
"description": "Invalid request"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/api/upstreams": {
"get": {
"tags": [
"Nginx"
],
"operationId": "get_upstream_list",
"responses": {
"200": {
"description": "List upstreams",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpstreamListResponse"
}
}
}
},
"500": {
"description": "Internal server error"
}
}
},
"post": {
"tags": [
"Nginx"
],
"operationId": "create_upstream",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateUpstreamRequestBody"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Upstream created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpstreamInfoResponse"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"422": {
"description": "Invalid request"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/api/upstreams/{upstream_id}": {
"get": {
"tags": [
"Nginx"
],
"operationId": "get_upstream",
"parameters": [
{
"name": "upstream_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Get upstream info",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpstreamInfoResponse"
}
}
}
},
"404": {
"description": "Not found"
},
"500": {
"description": "Internal server error"
}
}
},
"delete": {
"tags": [
"Nginx"
],
"operationId": "remove_upstream",
"parameters": [
{
"name": "upstream_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Upstream removed successfully",
"content": {
"application/json": {
"schema": {
"default": null
}
}
}
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Not found"
},
"500": {
"description": "Internal server error"
}
}
},
"patch": {
"tags": [
"Nginx"
],
"operationId": "update_upstream",
"parameters": [
{
"name": "upstream_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateUpstreamRequestBody"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Upstream updated successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateUpstreamInfoResponse"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"404": {
"description": "Not found"
},
"422": {
"description": "Invalid request"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/api/upstreams/{upstream_id}/targets": {
"post": {
"tags": [
"Nginx"
],
"operationId": "add_upstream_target",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateUpstreamTargetInfo"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Upstream target created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpstreamTargetInfoResponse"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"422": {
"description": "Invalid request"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/api/user/me": {
"get": {
"tags": [
@@ -157,6 +508,102 @@
}
}
},
"CreateUpstreamRequestBody": {
"type": "object",
"required": [
"name",
"protocol",
"upstream_targets"
],
"properties": {
"algorithm": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
},
"protocol": {
"type": "string"
},
"sticky_session": {
"type": [
"boolean",
"null"
]
},
"upstream_targets": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UpstreamTargetInfo"
}
}
}
},
"CreateUpstreamTargetInfo": {
"type": "object",
"required": [
"upstream_id",
"host",
"port"
],
"properties": {
"enabled": {
"type": [
"boolean",
"null"
]
},
"host": {
"type": "string"
},
"is_backup": {
"type": [
"boolean",
"null"
]
},
"port": {
"type": "integer",
"format": "int64"
},
"upstream_id": {
"type": "string",
"format": "uuid"
},
"weight": {
"type": [
"integer",
"null"
],
"format": "int64"
}
}
},
"GetUpstreamParams": {
"type": "object",
"properties": {
"include_targets": {
"type": [
"boolean",
"null"
]
}
}
},
"GetUpstreamTargetsParams": {
"type": "object",
"properties": {
"include_upstream": {
"type": [
"boolean",
"null"
]
}
}
},
"HealthInfo": {
"type": "object",
"description": "System health information",
@@ -212,6 +659,486 @@
}
}
},
"PaginationInfo": {
"type": "object",
"description": "Pagination information included in API responses",
"required": [
"total_items",
"total_pages",
"current_page",
"per_page"
],
"properties": {
"current_page": {
"type": "integer",
"format": "int32",
"description": "Current page number",
"minimum": 0
},
"per_page": {
"type": "integer",
"format": "int32",
"description": "Items per page",
"minimum": 0
},
"total_items": {
"type": "integer",
"format": "int64",
"description": "Total number of items",
"minimum": 0
},
"total_pages": {
"type": "integer",
"format": "int32",
"description": "Total number of pages",
"minimum": 0
}
}
},
"UpdateUpstreamInfoResponse": {
"type": "object",
"required": [
"id",
"name",
"protocol",
"algorithm",
"sticky_session",
"created_at",
"updated_at",
"upstream_targets"
],
"properties": {
"algorithm": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"created_by": {
"type": [
"string",
"null"
],
"format": "uuid"
},
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"protocol": {
"type": "string"
},
"sticky_session": {
"type": "boolean"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"upstream_targets": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UpstreamTargetBasicInfo"
}
}
}
},
"UpdateUpstreamRequestBody": {
"type": "object",
"properties": {
"algorithm": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"protocol": {
"type": [
"string",
"null"
]
},
"sticky_session": {
"type": [
"boolean",
"null"
]
},
"upstream_targets": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/UpstreamTargetBasicUpdateInfo"
}
}
}
},
"UpdateUpstreamTargetInfoResponse": {
"type": "object",
"required": [
"id",
"host",
"port",
"enabled",
"is_backup",
"weight",
"created_at",
"updated_at",
"upstream_id"
],
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
},
"enabled": {
"type": "boolean"
},
"host": {
"type": "string"
},
"id": {
"type": "string",
"format": "uuid"
},
"is_backup": {
"type": "boolean"
},
"port": {
"type": "integer",
"format": "int64"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"upstream_id": {
"type": "string",
"format": "uuid"
},
"weight": {
"type": "integer",
"format": "int32"
}
}
},
"UpdateUpstreamTargetRequestBody": {
"type": "object",
"properties": {
"enabled": {
"type": [
"boolean",
"null"
]
},
"host": {
"type": [
"string",
"null"
]
},
"is_backup": {
"type": [
"boolean",
"null"
]
},
"port": {
"type": [
"integer",
"null"
],
"format": "int64"
},
"weight": {
"type": [
"integer",
"null"
],
"format": "int32"
}
}
},
"UpstreamBasicInfo": {
"type": "object",
"required": [
"id",
"name",
"protocol",
"created_at",
"updated_at"
],
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
},
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"protocol": {
"type": "string"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
}
},
"UpstreamInfoResponse": {
"type": "object",
"required": [
"id",
"name",
"protocol",
"algorithm",
"sticky_session",
"created_at",
"updated_at",
"upstream_targets"
],
"properties": {
"algorithm": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"created_by": {
"type": [
"string",
"null"
],
"format": "uuid"
},
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"protocol": {
"type": "string"
},
"sticky_session": {
"type": "boolean"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"upstream_targets": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UpstreamTargetBasicInfo"
}
}
}
},
"UpstreamListResponse": {
"type": "object",
"required": [
"items",
"pagination"
],
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UpstreamInfoResponse"
}
},
"pagination": {
"$ref": "#/components/schemas/PaginationInfo"
}
}
},
"UpstreamTargetBasicInfo": {
"type": "object",
"required": [
"id",
"target_host",
"target_port",
"enabled",
"is_backup",
"weight",
"created_at",
"updated_at"
],
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
},
"enabled": {
"type": "boolean"
},
"id": {
"type": "string",
"format": "uuid"
},
"is_backup": {
"type": "boolean"
},
"target_host": {
"type": "string"
},
"target_port": {
"type": "integer",
"format": "int64"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"weight": {
"type": "integer",
"format": "int32"
}
}
},
"UpstreamTargetBasicUpdateInfo": {
"type": "object",
"required": [
"id",
"enabled"
],
"properties": {
"enabled": {
"type": "boolean"
},
"id": {
"type": "integer",
"format": "int64"
}
}
},
"UpstreamTargetInfo": {
"type": "object",
"required": [
"id",
"target_host",
"target_port",
"enabled",
"is_backup",
"weight",
"created_at",
"updated_at",
"upstream_id"
],
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
},
"enabled": {
"type": "boolean"
},
"id": {
"type": "string",
"format": "uuid"
},
"is_backup": {
"type": "boolean"
},
"target_host": {
"type": "string"
},
"target_port": {
"type": "integer",
"format": "int64"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"upstream": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/UpstreamBasicInfo"
}
]
},
"upstream_id": {
"type": "string",
"format": "uuid"
},
"weight": {
"type": "integer",
"format": "int32"
}
}
},
"UpstreamTargetInfoResponse": {
"type": "object",
"required": [
"id",
"host",
"port",
"enabled",
"is_backup",
"weight",
"created_at",
"updated_at",
"upstream_id"
],
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
},
"enabled": {
"type": "boolean"
},
"host": {
"type": "string"
},
"id": {
"type": "string",
"format": "uuid"
},
"is_backup": {
"type": "boolean"
},
"port": {
"type": "integer",
"format": "int64"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"upstream_id": {
"type": "string",
"format": "uuid"
},
"weight": {
"type": "integer",
"format": "int32"
}
}
},
"UserInfo": {
"type": "object",
"description": "System health information",
@@ -245,6 +1172,10 @@
{
"name": "User",
"description": "User management API"
},
{
"name": "Nginx",
"description": "Nginx management API"
}
]
}