{
  "openapi": "3.0.0",
  "info": {
    "title": "n8n 公共 API",
    "version": "1.1.1"
  },
  "tags": [
    {
      "name": "DataTable",
      "description": "数据表及其行相关操作"
    }
  ],
  "servers": [
    {
      "url": "/api/v1",
      "description": "当前 n8n 实例（自托管版本的内置测试台）"
    },
    {
      "url": "{url}/api/v1",
      "description": "自托管 n8n 实例",
      "variables": {
        "url": {
          "default": "https://example.com"
        }
      }
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "CookieAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-N8N-API-KEY"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "CookieAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "n8n-auth"
      }
    },
    "responses": {
      "unauthorized": {
        "description": "未授权"
      },
      "forbidden": {
        "description": "禁止访问"
      },
      "notFound": {
        "description": "未找到指定资源。"
      }
    }
  },
  "paths": {
    "/data-tables/{dataTableId}/columns": {
      "get": {
        "operationId": "listDataTableColumns",
        "tags": [
          "DataTable"
        ],
        "summary": "列出数据表的列",
        "description": "获取特定数据表的所有列。",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "nanoid",
              "pattern": "^[A-Za-z0-9]{16}$"
            },
            "required": true,
            "description": "数据表的 ID",
            "name": "dataTableId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "操作成功。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "列 ID"
                      },
                      "name": {
                        "type": "string",
                        "description": "列名称"
                      },
                      "type": {
                        "type": "string",
                        "description": "列的数据类型",
                        "enum": [
                          "string",
                          "number",
                          "boolean",
                          "date"
                        ]
                      },
                      "index": {
                        "type": "integer",
                        "description": "列位置"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "列创建的时间戳"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "列上次更新的时间戳"
                      },
                      "dataTableId": {
                        "type": "string",
                        "description": "此列所属数据表的 ID"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "type",
                      "index",
                      "createdAt",
                      "updatedAt",
                      "dataTableId"
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/forbidden"
          },
          "404": {
            "$ref": "#/components/responses/notFound"
          }
        }
      }
    }
  }
}
