{
  "openapi": "3.1.0",
  "info": {
    "title": "Upload",
    "description": "API service for App Factory reusable modules",
    "version": "1.0.0",
    "x-source-commit": "f33cc2b935f31b36240d724948dc8b9c765430cc"
  },
  "paths": {
    "/api/v1/upload/presign": {
      "post": {
        "tags": [
          "upload"
        ],
        "summary": "Presign Upload",
        "description": "签发对象存储直传凭证。\n\n- mode=put：返回 upload_url，客户端 PUT 原始 body\n- mode=proxy：本地盘或不支持时，客户端应走 /upload/minio\n允许匿名（与 /minio 一致，供工具输入）。",
        "operationId": "presign_upload_api_v1_upload_presign_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PresignRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/upload/minio": {
      "post": {
        "tags": [
          "upload"
        ],
        "summary": "Upload To Minio",
        "description": "代理上传到对象存储（默认 TOS），返回可下载 URL。\n\n路径名 `/minio` 为历史兼容；直传失败时 Web 会降级到此接口。",
        "operationId": "upload_to_minio_api_v1_upload_minio_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_upload_to_minio_api_v1_upload_minio_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Body_upload_to_minio_api_v1_upload_minio_post": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File",
            "description": "待上传的文件"
          },
          "folder": {
            "type": "string",
            "title": "Folder",
            "description": "存储子目录",
            "default": "uploads"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_upload_to_minio_api_v1_upload_minio_post"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "PresignRequest": {
        "properties": {
          "filename": {
            "type": "string",
            "title": "Filename",
            "description": "原始文件名（用于扩展名）"
          },
          "content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content Type",
            "description": "MIME 类型"
          },
          "size": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Size",
            "description": "声明的字节大小"
          },
          "folder": {
            "type": "string",
            "title": "Folder",
            "description": "对象前缀目录",
            "default": "uploads"
          },
          "mode": {
            "type": "string",
            "title": "Mode",
            "description": "put | post（Web 用 put）",
            "default": "put"
          }
        },
        "type": "object",
        "required": [
          "filename"
        ],
        "title": "PresignRequest"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.sniphunter.com"
    }
  ]
}