Skip to content

Commit

Permalink
fix: supported_adapters 不应该有默认值
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Feb 5, 2024
1 parent 17d982d commit e02b972
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/validation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class PluginPublishInfo(PublishInfo, PyPIMixin):

type: str
"""插件类型"""
supported_adapters: list[str] | None = None
supported_adapters: list[str] | None
"""插件支持的适配器"""

@field_validator("type", mode="before")
Expand Down
2 changes: 1 addition & 1 deletion tests/publish/process/test_publish_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ async def test_skip_plugin_check(
"owner": "he0119",
"repo": "action-test",
"issue_number": 70,
"body": """# 📃 商店发布检查结果\n\n> Plugin: \n\n**⚠️ 在发布检查过程中,我们发现以下问题:**\n\n<pre><code><li>⚠️ 名称: 无法匹配到数据。<dt>请确保填写该项目。</dt></li><li>⚠️ 描述: 无法匹配到数据。<dt>请确保填写该项目。</dt></li><li>⚠️ 项目仓库/主页链接: 无法匹配到数据。<dt>请确保填写该项目。</dt></li><li>⚠️ 插件类型: 无法匹配到数据。<dt>请确保填写该项目。</dt></li></code></pre>\n\n<details>\n<summary>详情</summary>\n<pre><code><li>✅ 项目 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI。</li><li>✅ 标签: test-#ffffff。</li><li>✅ 插件 <a href="https://github.com/owner/repo/actions/runs/123456">加载测试</a> 已跳过。</li></code></pre>\n</details>\n\n---\n\n💡 如需修改信息,请直接修改 issue,机器人会自动更新检查结果。\n💡 当插件加载测试失败时,请发布新版本后在当前页面下评论任意内容以触发测试。\n\n\n💪 Powered by [NoneFlow](https://github.com/nonebot/noneflow)\n<!-- NONEFLOW -->\n""",
"body": """# 📃 商店发布检查结果\n\n> Plugin: \n\n**⚠️ 在发布检查过程中,我们发现以下问题:**\n\n<pre><code><li>⚠️ 名称: 无法匹配到数据。<dt>请确保填写该项目。</dt></li><li>⚠️ 描述: 无法匹配到数据。<dt>请确保填写该项目。</dt></li><li>⚠️ 项目仓库/主页链接: 无法匹配到数据。<dt>请确保填写该项目。</dt></li><li>⚠️ 插件类型: 无法匹配到数据。<dt>请确保填写该项目。</dt></li><li>⚠️ 插件支持的适配器: 无法匹配到数据。<dt>请确保填写该项目。</dt></li></code></pre>\n\n<details>\n<summary>详情</summary>\n<pre><code><li>✅ 项目 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI。</li><li>✅ 标签: test-#ffffff。</li><li>✅ 插件 <a href="https://github.com/owner/repo/actions/runs/123456">加载测试</a> 已跳过。</li></code></pre>\n</details>\n\n---\n\n💡 如需修改信息,请直接修改 issue,机器人会自动更新检查结果。\n💡 当插件加载测试失败时,请发布新版本后在当前页面下评论任意内容以触发测试。\n\n\n💪 Powered by [NoneFlow](https://github.com/nonebot/noneflow)\n<!-- NONEFLOW -->\n""",
},
True,
)
Expand Down
6 changes: 5 additions & 1 deletion tests/utils/validation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@


def exclude_none(data: dict[str, Any]) -> dict[str, Any]:
return {k: v for k, v in data.items() if v is not None}
"""去除字典中的 None 值
supported_adapters 字段除外
"""
return {k: v for k, v in data.items() if v is not None or k == "supported_adapters"}


def generate_adapter_data(
Expand Down

0 comments on commit e02b972

Please sign in to comment.