Skip to content

fix(ecs): correct type hints for DescribeInstances request#43

Open
ethreal798 wants to merge 1 commit into
aliyun:masterfrom
ethreal798:fix/type-hint-describe-instances
Open

fix(ecs): correct type hints for DescribeInstances request#43
ethreal798 wants to merge 1 commit into
aliyun:masterfrom
ethreal798:fix/type-hint-describe-instances

Conversation

@ethreal798
Copy link
Copy Markdown

Bug 修复说明

修复了 DescribeInstances 接口的 SDK 类型提示错误以及提出 API 官方文档中的参数描述错误。

1. SDK 代码修复 (Type Hint)

问题现象:
当前 SDK 中 DescribeInstances 方法的类型注解不准确,导致 PyCharm 的静态检查器报错。
具体表现:
传入 InstanceIds 列表时,IDE 提示类型不匹配,期望 str 但收到 List[str]],Expected type 'str | None', got 'list[str]' instead
修复方案:
修正了 _describe_instances_request.py 文件中 DescribeInstancesRequest 类的类型定义,使其符合实际 API 规范。

2. 文档修正建议 (API DOC)

发现问题:
在核对代码时,我发现官方 API [https://api.aliyun.com/api/Ecs/2014-05-26/DescribeInstances?tab=DOC] 文档中的参数描述存在误导或错误。
具体位置:

  • 参数名: InstanceIds (位于请求参数表格中)
  • 错误描述: 文档中将 InstanceIds 类型标记为 string
  • 建议修正: 应修改该参数类型为array而不是字符串
  • **理由:**保持文档与 SDK 代码的一致性,能极大降低开发者的学习成本和调试时间。

测试验证

  • 本地运行测试通过,无类型检查警告。
  • 对比 API 文档,确认参数格式已对齐。
阿里文档错误

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 21, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants