This commit is contained in:
@@ -276,6 +276,7 @@ def compare_endpoints(
|
||||
break
|
||||
|
||||
# 2. URI 路径变更检测(method + controller + method_name 相同,但 uri 不同)
|
||||
# 同时检测参数变更,即使 URI 改变也记录参数差异
|
||||
for r_key, r_ep in unmatched_removed:
|
||||
if r_key in matched_removed:
|
||||
continue
|
||||
@@ -288,6 +289,7 @@ def compare_endpoints(
|
||||
and r_ep.method_name == a_ep.method_name
|
||||
and r_ep.uri != a_ep.uri
|
||||
):
|
||||
param_changes = compare_parameters(r_ep.parameters, a_ep.parameters)
|
||||
reports.append(
|
||||
EndpointChangeReport(
|
||||
uri=a_ep.uri,
|
||||
@@ -297,6 +299,7 @@ def compare_endpoints(
|
||||
source_file=a_ep.source_file,
|
||||
is_renamed_endpoint=True,
|
||||
old_uri=r_ep.uri,
|
||||
parameter_changes=param_changes,
|
||||
)
|
||||
)
|
||||
matched_removed.add(r_key)
|
||||
|
||||
@@ -79,12 +79,13 @@ def build_markdown_notification(
|
||||
method_changed_reports = [r for r in reports if r.is_method_changed]
|
||||
renamed_reports = [r for r in reports if r.is_renamed_endpoint]
|
||||
new_reports = [r for r in reports if r.is_new_endpoint]
|
||||
# 参数变更报告:包含普通参数变更 + 路径变更时同时修改了参数的情况
|
||||
changed_reports = [
|
||||
r for r in reports
|
||||
if not r.is_new_endpoint
|
||||
and not r.is_removed_endpoint
|
||||
and not r.is_renamed_endpoint
|
||||
and not r.is_method_changed
|
||||
# 注意:不再排除 is_renamed_endpoint,允许「路径+参数」同时变更时发参数通知
|
||||
]
|
||||
removed_reports = [r for r in reports if r.is_removed_endpoint]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user