字段说明获取
All checks were successful
API接口参数变更检测 / api-param-check (push) Successful in 16s

This commit is contained in:
2026-06-05 15:04:13 +08:00
parent 77479a40a1
commit f7fc0dd453
4 changed files with 40 additions and 5 deletions

View File

@@ -31,6 +31,7 @@ class ParameterChange:
required: Optional[bool] = None
old_required: Optional[bool] = None
detail: Optional[str] = None
description: Optional[str] = None
def to_markdown_line(self, *, plain: bool = False) -> str:
"""
@@ -46,7 +47,8 @@ class ParameterChange:
if req_required
else '<font color="comment">可选</font>'
)
return f'> `{self.param_type}` **{self.param_name}** · {tag}'
desc = f" <font color=\"comment\">{self.description}</font>" if self.description else ""
return f'> `{self.param_type}` **{self.param_name}** · {tag}{desc}'
if self.change_type == ChangeType.REMOVED:
return (
@@ -59,9 +61,10 @@ class ParameterChange:
if req_required
else '<font color="comment">可选</font>'
)
desc = f" <font color=\"comment\">{self.description}</font>" if self.description else ""
return (
f'<font color="info">【新增】</font> '
f'`{self.param_type}` **{self.param_name}** · {tag}'
f'`{self.param_type}` **{self.param_name}** · {tag}{desc}'
)
if self.change_type == ChangeType.RENAMED:
return (
@@ -209,6 +212,7 @@ def compare_parameters(
param_name=param.name,
param_type=param.type,
required=param.required,
description=param.description,
)
)
@@ -365,6 +369,7 @@ def compare_endpoints(
param_name=p.name,
param_type=p.type,
required=p.required,
description=p.description,
)
for p in ep.parameters
],