From 20e9e36d29eae8d2982cd9016408903b510a0dd3 Mon Sep 17 00:00:00 2001 From: root <1772105645@qq.com> Date: Sat, 27 Dec 2025 10:44:50 +0800 Subject: [PATCH] =?UTF-8?q?docs=EF=BC=9A=E6=9B=B4=E6=96=B0swagger=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/docs.go | 227 ++++++++++++++++++++++++++++++++++++---------- docs/swagger.json | 227 ++++++++++++++++++++++++++++++++++++---------- docs/swagger.yaml | 151 +++++++++++++++++++++++------- 3 files changed, 474 insertions(+), 131 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 1a6b7ab..79f8781 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -71,7 +71,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/requests.CreateBucketRequest" + "$ref": "#/definitions/file-system_internal_api_requests.CreateBucketRequest" } } ], @@ -104,6 +104,114 @@ const docTemplate = `{ } } } + }, + "delete": { + "description": "删除指定的 S3 存储桶(桶必须为空)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "存储桶管理" + ], + "summary": "删除存储桶", + "parameters": [ + { + "description": "删除存储桶请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/file-system_internal_api_requests.DeleteBucketRequest" + } + } + ], + "responses": { + "200": { + "description": "删除成功消息", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "400": { + "description": "参数错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/files/delete": { + "delete": { + "description": "从指定的存储桶删除文件", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文件操作" + ], + "summary": "删除文件", + "parameters": [ + { + "description": "请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/file-system_internal_api_requests.DeleteFileRequest" + } + } + ], + "responses": { + "200": { + "description": "删除成功消息", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "400": { + "description": "参数错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } } }, "/files/download": { @@ -207,7 +315,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/repository.ListFilesResult" + "$ref": "#/definitions/file-system_internal_domain_repository.ListFilesResult" } }, "400": { @@ -251,7 +359,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/requests.CompleteMultipartRequest" + "$ref": "#/definitions/file-system_internal_api_requests.CompleteMultipartRequest" } } ], @@ -306,7 +414,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/requests.InitMultipartRequest" + "$ref": "#/definitions/file-system_internal_api_requests.InitMultipartRequest" } } ], @@ -544,18 +652,77 @@ const docTemplate = `{ } }, "definitions": { - "common.Part": { + "file-system_internal_api_requests.CompleteMultipartRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + }, + "object_key": { + "type": "string" + }, + "parts": { + "type": "array", + "items": { + "$ref": "#/definitions/file-system_internal_common.Part" + } + }, + "upload_id": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.CreateBucketRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.DeleteBucketRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.DeleteFileRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + }, + "object_key": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.InitMultipartRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + }, + "object_key": { + "type": "string" + } + } + }, + "file-system_internal_common.Part": { "type": "object", "properties": { "etag": { "type": "string" }, "partNumber": { - "type": "integer" + "type": "integer", + "format": "int32" } } }, - "repository.FileInfo": { + "file-system_internal_domain_repository.FileInfo": { "type": "object", "properties": { "etag": { @@ -568,62 +735,24 @@ const docTemplate = `{ "type": "string" }, "size": { - "type": "integer" + "type": "integer", + "format": "int64" } } }, - "repository.ListFilesResult": { + "file-system_internal_domain_repository.ListFilesResult": { "type": "object", "properties": { "files": { "type": "array", "items": { - "$ref": "#/definitions/repository.FileInfo" + "$ref": "#/definitions/file-system_internal_domain_repository.FileInfo" } }, "nextContinuationToken": { "type": "string" } } - }, - "requests.CompleteMultipartRequest": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "object_key": { - "type": "string" - }, - "parts": { - "type": "array", - "items": { - "$ref": "#/definitions/common.Part" - } - }, - "upload_id": { - "type": "string" - } - } - }, - "requests.CreateBucketRequest": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - } - } - }, - "requests.InitMultipartRequest": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "object_key": { - "type": "string" - } - } } } }` diff --git a/docs/swagger.json b/docs/swagger.json index 8243be7..d8e92f8 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -65,7 +65,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/requests.CreateBucketRequest" + "$ref": "#/definitions/file-system_internal_api_requests.CreateBucketRequest" } } ], @@ -98,6 +98,114 @@ } } } + }, + "delete": { + "description": "删除指定的 S3 存储桶(桶必须为空)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "存储桶管理" + ], + "summary": "删除存储桶", + "parameters": [ + { + "description": "删除存储桶请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/file-system_internal_api_requests.DeleteBucketRequest" + } + } + ], + "responses": { + "200": { + "description": "删除成功消息", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "400": { + "description": "参数错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "/files/delete": { + "delete": { + "description": "从指定的存储桶删除文件", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "文件操作" + ], + "summary": "删除文件", + "parameters": [ + { + "description": "请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/file-system_internal_api_requests.DeleteFileRequest" + } + } + ], + "responses": { + "200": { + "description": "删除成功消息", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "400": { + "description": "参数错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "500": { + "description": "服务器内部错误", + "schema": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } } }, "/files/download": { @@ -201,7 +309,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/repository.ListFilesResult" + "$ref": "#/definitions/file-system_internal_domain_repository.ListFilesResult" } }, "400": { @@ -245,7 +353,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/requests.CompleteMultipartRequest" + "$ref": "#/definitions/file-system_internal_api_requests.CompleteMultipartRequest" } } ], @@ -300,7 +408,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/requests.InitMultipartRequest" + "$ref": "#/definitions/file-system_internal_api_requests.InitMultipartRequest" } } ], @@ -538,18 +646,77 @@ } }, "definitions": { - "common.Part": { + "file-system_internal_api_requests.CompleteMultipartRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + }, + "object_key": { + "type": "string" + }, + "parts": { + "type": "array", + "items": { + "$ref": "#/definitions/file-system_internal_common.Part" + } + }, + "upload_id": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.CreateBucketRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.DeleteBucketRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.DeleteFileRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + }, + "object_key": { + "type": "string" + } + } + }, + "file-system_internal_api_requests.InitMultipartRequest": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + }, + "object_key": { + "type": "string" + } + } + }, + "file-system_internal_common.Part": { "type": "object", "properties": { "etag": { "type": "string" }, "partNumber": { - "type": "integer" + "type": "integer", + "format": "int32" } } }, - "repository.FileInfo": { + "file-system_internal_domain_repository.FileInfo": { "type": "object", "properties": { "etag": { @@ -562,62 +729,24 @@ "type": "string" }, "size": { - "type": "integer" + "type": "integer", + "format": "int64" } } }, - "repository.ListFilesResult": { + "file-system_internal_domain_repository.ListFilesResult": { "type": "object", "properties": { "files": { "type": "array", "items": { - "$ref": "#/definitions/repository.FileInfo" + "$ref": "#/definitions/file-system_internal_domain_repository.FileInfo" } }, "nextContinuationToken": { "type": "string" } } - }, - "requests.CompleteMultipartRequest": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "object_key": { - "type": "string" - }, - "parts": { - "type": "array", - "items": { - "$ref": "#/definitions/common.Part" - } - }, - "upload_id": { - "type": "string" - } - } - }, - "requests.CreateBucketRequest": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - } - } - }, - "requests.InitMultipartRequest": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "object_key": { - "type": "string" - } - } } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b19abfa..568891b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,13 +1,51 @@ basePath: / definitions: - common.Part: + file-system_internal_api_requests.CompleteMultipartRequest: + properties: + bucket_name: + type: string + object_key: + type: string + parts: + items: + $ref: '#/definitions/file-system_internal_common.Part' + type: array + upload_id: + type: string + type: object + file-system_internal_api_requests.CreateBucketRequest: + properties: + bucket_name: + type: string + type: object + file-system_internal_api_requests.DeleteBucketRequest: + properties: + bucket_name: + type: string + type: object + file-system_internal_api_requests.DeleteFileRequest: + properties: + bucket_name: + type: string + object_key: + type: string + type: object + file-system_internal_api_requests.InitMultipartRequest: + properties: + bucket_name: + type: string + object_key: + type: string + type: object + file-system_internal_common.Part: properties: etag: type: string partNumber: + format: int32 type: integer type: object - repository.FileInfo: + file-system_internal_domain_repository.FileInfo: properties: etag: type: string @@ -16,42 +54,18 @@ definitions: lastModified: type: string size: + format: int64 type: integer type: object - repository.ListFilesResult: + file-system_internal_domain_repository.ListFilesResult: properties: files: items: - $ref: '#/definitions/repository.FileInfo' + $ref: '#/definitions/file-system_internal_domain_repository.FileInfo' type: array nextContinuationToken: type: string type: object - requests.CompleteMultipartRequest: - properties: - bucket_name: - type: string - object_key: - type: string - parts: - items: - $ref: '#/definitions/common.Part' - type: array - upload_id: - type: string - type: object - requests.CreateBucketRequest: - properties: - bucket_name: - type: string - type: object - requests.InitMultipartRequest: - properties: - bucket_name: - type: string - object_key: - type: string - type: object host: localhost:8080 info: contact: {} @@ -60,6 +74,41 @@ info: version: "1.1" paths: /buckets: + delete: + consumes: + - application/json + description: 删除指定的 S3 存储桶(桶必须为空) + parameters: + - description: 删除存储桶请求参数 + in: body + name: request + required: true + schema: + $ref: '#/definitions/file-system_internal_api_requests.DeleteBucketRequest' + produces: + - application/json + responses: + "200": + description: 删除成功消息 + schema: + additionalProperties: + type: string + type: object + "400": + description: 参数错误 + schema: + additionalProperties: + type: string + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: + type: string + type: object + summary: 删除存储桶 + tags: + - 存储桶管理 get: consumes: - application/json @@ -94,7 +143,7 @@ paths: name: request required: true schema: - $ref: '#/definitions/requests.CreateBucketRequest' + $ref: '#/definitions/file-system_internal_api_requests.CreateBucketRequest' produces: - application/json responses: @@ -119,6 +168,42 @@ paths: summary: 创建存储桶 tags: - 存储桶管理 + /files/delete: + delete: + consumes: + - application/json + description: 从指定的存储桶删除文件 + parameters: + - description: 请求参数 + in: body + name: request + required: true + schema: + $ref: '#/definitions/file-system_internal_api_requests.DeleteFileRequest' + produces: + - application/json + responses: + "200": + description: 删除成功消息 + schema: + additionalProperties: + type: string + type: object + "400": + description: 参数错误 + schema: + additionalProperties: + type: string + type: object + "500": + description: 服务器内部错误 + schema: + additionalProperties: + type: string + type: object + summary: 删除文件 + tags: + - 文件操作 /files/download: get: consumes: @@ -186,7 +271,7 @@ paths: "200": description: OK schema: - $ref: '#/definitions/repository.ListFilesResult' + $ref: '#/definitions/file-system_internal_domain_repository.ListFilesResult' "400": description: Bad Request schema: @@ -213,7 +298,7 @@ paths: name: request required: true schema: - $ref: '#/definitions/requests.CompleteMultipartRequest' + $ref: '#/definitions/file-system_internal_api_requests.CompleteMultipartRequest' produces: - application/json responses: @@ -249,7 +334,7 @@ paths: name: request required: true schema: - $ref: '#/definitions/requests.InitMultipartRequest' + $ref: '#/definitions/file-system_internal_api_requests.InitMultipartRequest' produces: - application/json responses: