{
  "openapi": "3.0.0",
  "info": {
    "title": "n8n 公共 API",
    "version": "1.1.1"
  },
  "tags": [
    {
      "name": "Promotions",
      "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"
      }
    },
    "parameters": {
      "idempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "description": "此 POST 请求的安全重试键。使用 1 到 128 个可见 ASCII 字符。相同的键配合相同的请求，会返回首次成功的响应。使用此键发送不同请求时返回 422。首次请求仍在处理时重试，会返回 409。",
        "required": false,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[\\x21-\\x7E]+$"
        }
      }
    },
    "schemas": {
      "applyPackageResultDto.generated": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "environmentId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 36
              },
              "git": {
                "type": "object",
                "properties": {
                  "commitSha": {
                    "type": "string"
                  },
                  "branchName": {
                    "type": "string"
                  }
                },
                "required": [
                  "commitSha",
                  "branchName"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "applied"
                ]
              },
              "counts": {
                "type": "object",
                "properties": {
                  "projects": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "updated": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "skipped": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "deleted": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "created",
                      "updated",
                      "skipped",
                      "deleted"
                    ]
                  },
                  "folders": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "updated": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Apply 为匹配分支而移动或重命名的现有文件夹。"
                      },
                      "skipped": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "moved": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Apply 将其移到项目内其他父文件夹下的已更新文件夹，也包含在 `updated` 中。"
                      },
                      "renamed": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Apply 将其名称改为分支上名称的已更新文件夹，也包含在 `updated` 中。"
                      },
                      "removed": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "created",
                      "updated",
                      "skipped",
                      "moved",
                      "renamed",
                      "removed"
                    ]
                  },
                  "workflows": {
                    "type": "object",
                    "properties": {
                      "created": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "updated": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "skipped": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "moved": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Apply 同时将其移到项目内其他文件夹的已更新工作流，也包含在 `updated` 中。"
                      },
                      "archived": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "deleted": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "publishing": {
                        "type": "object",
                        "properties": {
                          "published": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "unpublished": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "unchanged": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "blocked": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "failed": {
                            "type": "integer",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "published",
                          "unpublished",
                          "unchanged",
                          "blocked",
                          "failed"
                        ]
                      }
                    },
                    "required": [
                      "created",
                      "updated",
                      "skipped",
                      "moved",
                      "archived",
                      "deleted",
                      "publishing"
                    ]
                  },
                  "credentials": {
                    "type": "object",
                    "properties": {
                      "matched": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "stubbed": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "updated": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "matched",
                      "stubbed",
                      "updated"
                    ]
                  },
                  "dataTables": {
                    "type": "object",
                    "properties": {
                      "matched": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "created": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "updated": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "matched",
                      "created",
                      "updated"
                    ]
                  },
                  "variables": {
                    "type": "object",
                    "properties": {
                      "matched": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "created": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "updated": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "stubbed": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "missing": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "matched",
                      "created",
                      "updated",
                      "stubbed",
                      "missing"
                    ]
                  },
                  "tags": {
                    "type": "object",
                    "properties": {
                      "matched": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "created": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "renamed": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "reconciled": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "skipped": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "matched",
                      "created",
                      "renamed",
                      "reconciled",
                      "skipped"
                    ]
                  }
                },
                "required": [
                  "projects",
                  "folders",
                  "workflows",
                  "credentials",
                  "dataTables",
                  "variables",
                  "tags"
                ]
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "variable"
                      ]
                    },
                    "code": {
                      "type": "string",
                      "enum": [
                        "variable-shadowed"
                      ]
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "scope": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "global"
                          ]
                        }
                      },
                      "required": [
                        "kind"
                      ]
                    },
                    "consumers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "project": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ]
                          },
                          "workflows": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            },
                            "minItems": 1
                          }
                        },
                        "required": [
                          "project",
                          "workflows"
                        ]
                      },
                      "minItems": 1
                    }
                  },
                  "required": [
                    "kind",
                    "code",
                    "name",
                    "scope",
                    "consumers"
                  ]
                }
              }
            },
            "required": [
              "environmentId",
              "git",
              "status",
              "counts",
              "warnings"
            ]
          },
          {
            "type": "object",
            "properties": {
              "environmentId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 36
              },
              "git": {
                "type": "object",
                "properties": {
                  "commitSha": {
                    "type": "string"
                  },
                  "branchName": {
                    "type": "string"
                  }
                },
                "required": [
                  "commitSha",
                  "branchName"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "blocked"
                ]
              },
              "preflight": {
                "type": "object",
                "properties": {
                  "missingProjects": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string"
                        },
                        "icon": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "emoji",
                                "icon"
                              ]
                            },
                            "value": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "value"
                          ]
                        },
                        "description": {
                          "type": "string"
                        },
                        "customTelemetryTags": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "key",
                              "value"
                            ]
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ]
                    },
                    "description": "包中存在、但实例上不存在的项目。预检会保留其元数据，不检查项目创建规则。项目创建 API 可能拒绝无效值。"
                  },
                  "missingBindings": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "credential"
                              ]
                            },
                            "sourceId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "credentialType": {
                              "type": "string",
                              "minLength": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "ownerProject": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            },
                            "expressionData": {
                              "type": "object",
                              "additionalProperties": {
                                "$ref": "#/components/schemas/promotionCredentialExpressionValue.generated"
                              },
                              "description": "凭据表达式。"
                            }
                          },
                          "required": [
                            "kind",
                            "sourceId",
                            "name",
                            "credentialType",
                            "consumers",
                            "ownerProject"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "variable"
                              ]
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1
                            },
                            "variableType": {
                              "type": "string",
                              "enum": [
                                "string"
                              ],
                              "default": "string"
                            },
                            "scope": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "global"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "project"
                                      ]
                                    },
                                    "project": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "project"
                                  ]
                                }
                              ],
                              "type": "object"
                            },
                            "sourceValue": {
                              "type": "string",
                              "maxLength": 1000
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            }
                          },
                          "required": [
                            "kind",
                            "name",
                            "scope",
                            "consumers"
                          ]
                        }
                      ],
                      "type": "object"
                    }
                  },
                  "accessRequirements": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "credential"
                          ]
                        },
                        "sourceId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string"
                        },
                        "credentialType": {
                          "type": "string",
                          "minLength": 1
                        },
                        "consumers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "project": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ]
                              },
                              "workflows": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "name"
                                  ]
                                },
                                "minItems": 1
                              }
                            },
                            "required": [
                              "project",
                              "workflows"
                            ]
                          },
                          "minItems": 1
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "access-required"
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "sourceId",
                        "name",
                        "credentialType",
                        "consumers",
                        "code"
                      ]
                    }
                  },
                  "conflicts": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "credential"
                              ]
                            },
                            "sourceId": {
                              "type": "string",
                              "nullable": true,
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "expectedTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "filePath": {
                              "type": "string"
                            },
                            "referenceFiles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "missing-id"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "sourceId",
                            "name",
                            "expectedTypes",
                            "referenceFiles",
                            "consumers",
                            "code"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "credential"
                              ]
                            },
                            "sourceId": {
                              "type": "string",
                              "nullable": true,
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "expectedTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "filePath": {
                              "type": "string"
                            },
                            "referenceFiles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "conflicting-types"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "sourceId",
                            "name",
                            "expectedTypes",
                            "referenceFiles",
                            "consumers",
                            "code"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "credential"
                              ]
                            },
                            "sourceId": {
                              "type": "string",
                              "nullable": true,
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "expectedTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "filePath": {
                              "type": "string"
                            },
                            "referenceFiles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "unknown-type"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "sourceId",
                            "name",
                            "expectedTypes",
                            "referenceFiles",
                            "consumers",
                            "code"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "credential"
                              ]
                            },
                            "sourceId": {
                              "type": "string",
                              "nullable": true,
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "expectedTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "filePath": {
                              "type": "string"
                            },
                            "referenceFiles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "unknown-owner"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "sourceId",
                            "name",
                            "expectedTypes",
                            "referenceFiles",
                            "consumers",
                            "code"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "credential"
                              ]
                            },
                            "sourceId": {
                              "type": "string",
                              "nullable": true,
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "expectedTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "filePath": {
                              "type": "string"
                            },
                            "referenceFiles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "type-mismatch"
                              ]
                            },
                            "targetType": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "sourceId",
                            "name",
                            "expectedTypes",
                            "referenceFiles",
                            "consumers",
                            "code",
                            "targetType"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "credential"
                              ]
                            },
                            "sourceId": {
                              "type": "string",
                              "nullable": true,
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "expectedTypes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "filePath": {
                              "type": "string"
                            },
                            "referenceFiles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "incompatible-usage-scope"
                              ]
                            },
                            "usageScope": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "sourceId",
                            "name",
                            "expectedTypes",
                            "referenceFiles",
                            "consumers",
                            "code",
                            "usageScope"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "variable"
                              ]
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "missing-definition"
                              ]
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1
                            },
                            "referenceFiles": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 1
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            }
                          },
                          "required": [
                            "kind",
                            "code",
                            "name",
                            "referenceFiles",
                            "consumers"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "project"
                              ]
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "project-not-team"
                              ]
                            },
                            "project": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            },
                            "filePath": {
                              "type": "string"
                            },
                            "workflows": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ]
                              }
                            }
                          },
                          "required": [
                            "kind",
                            "code",
                            "project",
                            "filePath",
                            "workflows"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "project"
                              ]
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "project-deletion"
                              ]
                            },
                            "project": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "code",
                            "project"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "data-table"
                              ]
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "destructive-change"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "name": {
                              "type": "string"
                            },
                            "consumers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "project": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "name"
                                      ]
                                    },
                                    "minItems": 1
                                  }
                                },
                                "required": [
                                  "project",
                                  "workflows"
                                ]
                              },
                              "minItems": 1
                            },
                            "changes": {
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "add-column"
                                        ]
                                      },
                                      "column": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string",
                                        "enum": [
                                          "string",
                                          "number",
                                          "boolean",
                                          "date"
                                        ]
                                      },
                                      "destructive": {
                                        "type": "boolean",
                                        "enum": [
                                          false
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "column",
                                      "type",
                                      "destructive"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "remove-column"
                                        ]
                                      },
                                      "column": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string",
                                        "enum": [
                                          "string",
                                          "number",
                                          "boolean",
                                          "date"
                                        ]
                                      },
                                      "destructive": {
                                        "type": "boolean",
                                        "enum": [
                                          true
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "column",
                                      "type",
                                      "destructive"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "change-column-type"
                                        ]
                                      },
                                      "column": {
                                        "type": "string"
                                      },
                                      "from": {
                                        "type": "string",
                                        "enum": [
                                          "string",
                                          "number",
                                          "boolean",
                                          "date"
                                        ]
                                      },
                                      "to": {
                                        "type": "string",
                                        "enum": [
                                          "string",
                                          "number",
                                          "boolean",
                                          "date"
                                        ]
                                      },
                                      "destructive": {
                                        "type": "boolean",
                                        "enum": [
                                          true
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "column",
                                      "from",
                                      "to",
                                      "destructive"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "rename-column"
                                        ]
                                      },
                                      "from": {
                                        "type": "string"
                                      },
                                      "to": {
                                        "type": "string"
                                      },
                                      "destructive": {
                                        "type": "boolean",
                                        "enum": [
                                          false
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "destructive"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "reorder-columns"
                                        ]
                                      },
                                      "destructive": {
                                        "type": "boolean",
                                        "enum": [
                                          false
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "destructive"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "rename-table"
                                        ]
                                      },
                                      "from": {
                                        "type": "string"
                                      },
                                      "to": {
                                        "type": "string"
                                      },
                                      "destructive": {
                                        "type": "boolean",
                                        "enum": [
                                          false
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "from",
                                      "to",
                                      "destructive"
                                    ]
                                  }
                                ],
                                "type": "object"
                              },
                              "minItems": 1
                            }
                          },
                          "required": [
                            "kind",
                            "code",
                            "id",
                            "name",
                            "consumers",
                            "changes"
                          ]
                        }
                      ],
                      "type": "object"
                    }
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "variable"
                          ]
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "variable-shadowed"
                          ]
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "scope": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "global"
                              ]
                            }
                          },
                          "required": [
                            "kind"
                          ]
                        },
                        "consumers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "project": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ]
                              },
                              "workflows": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "name"
                                  ]
                                },
                                "minItems": 1
                              }
                            },
                            "required": [
                              "project",
                              "workflows"
                            ]
                          },
                          "minItems": 1
                        }
                      },
                      "required": [
                        "kind",
                        "code",
                        "name",
                        "scope",
                        "consumers"
                      ]
                    }
                  }
                },
                "required": [
                  "missingProjects",
                  "missingBindings",
                  "accessRequirements",
                  "conflicts",
                  "warnings"
                ]
              }
            },
            "required": [
              "environmentId",
              "git",
              "status",
              "preflight"
            ]
          },
          {
            "type": "object",
            "properties": {
              "environmentId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 36
              },
              "git": {
                "type": "object",
                "properties": {
                  "commitSha": {
                    "type": "string"
                  },
                  "branchName": {
                    "type": "string"
                  }
                },
                "required": [
                  "commitSha",
                  "branchName"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "source-changed"
                ]
              }
            },
            "required": [
              "environmentId",
              "git",
              "status"
            ]
          }
        ],
        "type": "object"
      },
      "promotionCredentialExpressionValue.generated": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/promotionCredentialExpressionValue.generated"
            }
          },
          {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/promotionCredentialExpressionValue.generated"
            }
          }
        ],
        "description": "值可以是字符串、数组或嵌套对象。每个叶节点都是表达式字符串。"
      }
    },
    "responses": {
      "badRequest": {
        "description": "请求无效，或提供的数据格式错误。"
      },
      "unauthorized": {
        "description": "未授权"
      },
      "forbidden": {
        "description": "禁止访问"
      },
      "notFound": {
        "description": "未找到指定资源。"
      },
      "conflict": {
        "description": "冲突"
      },
      "unsupportedMediaType": {
        "description": "不支持的媒体类型。"
      },
      "unprocessableEntity": {
        "description": "无法处理的实体"
      },
      "serviceUnavailable": {
        "description": "所请求的服务暂时不可用。"
      }
    }
  },
  "paths": {
    "/promotions/projects/{projectId}/apply": {
      "post": {
        "operationId": "applyProjectSelection",
        "tags": [
          "Promotions"
        ],
        "summary": "应用项目中所选工作流",
        "description": "从项目的 Apply 分支应用选定工作流变更。通过 workflowIds 发送所选变更列表 ID。服务器会导入分支上属于此项目的所选 ID；对于所选 ID，如果实例中的对应工作流归此项目所有、但分支没有该 ID，则移除该工作流。重复或无效 ID 会拒绝整个请求，未选择的内容保持不变。所选工作流连同其所在文件夹一起在项目内移动，以匹配分支，相关文件夹也采用分支上的名称，其他文件夹保持原样。如果所选工作流，或分支上属于此项目的某文件夹，在分支和实例中归于不同项目，则在任何写入前以 409 拒绝。可选地发送 expectedSource，包含已审核变更预览中的 environmentId、branchName 和完整 commitSha。状态 `source-changed` 表示源在审核后发生变化，没有导入任何内容；选择项需要设置绑定时，`blocked` 会在导入写入前返回绑定详情。保留 environmentId 和 git，供 Continue 使用。状态 `applied` 包含数量统计和警告，应先检查状态，再读取数量。需要项目对应的已连接 Apply 环境，优先使用项目自己的 Apply 环境，否则使用实例 Apply 环境。API 密钥需要 gitConnection:pull 作用域。导入器会检查用户写入权限。",
        "parameters": [
          {
            "$ref": "#/components/parameters/idempotencyKey"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "项目的 ID。",
            "name": "projectId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workflowIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 36
                    },
                    "minItems": 1
                  },
                  "expectedSource": {
                    "type": "object",
                    "properties": {
                      "environmentId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 36
                      },
                      "branchName": {
                        "type": "string",
                        "minLength": 1
                      },
                      "commitSha": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$"
                      }
                    },
                    "required": [
                      "environmentId",
                      "branchName",
                      "commitSha"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "workflowIds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "操作成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/applyPackageResultDto.generated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/badRequest"
          },
          "401": {
            "$ref": "#/components/responses/unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/forbidden"
          },
          "404": {
            "$ref": "#/components/responses/notFound"
          },
          "409": {
            "$ref": "#/components/responses/conflict"
          },
          "415": {
            "$ref": "#/components/responses/unsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/unprocessableEntity"
          },
          "503": {
            "$ref": "#/components/responses/serviceUnavailable"
          }
        }
      }
    }
  }
}
