This commit is contained in:
@@ -29,16 +29,9 @@ public class EndpointSnapshot {
|
||||
this.parameters = parameters == null ? List.of() : new ArrayList<>(parameters);
|
||||
}
|
||||
|
||||
public static String buildFingerprint(String sourceFile, String methodName,
|
||||
List<MethodParameterSnapshot> parameters) {
|
||||
StringBuilder sig = new StringBuilder();
|
||||
for (int i = 0; i < parameters.size(); i++) {
|
||||
if (i > 0) {
|
||||
sig.append(',');
|
||||
}
|
||||
sig.append(parameters.get(i).fingerprintSlotKey(i));
|
||||
}
|
||||
return sourceFile + "#" + methodName + "#" + sig;
|
||||
/** 跨 commit 配对同一 Java 方法;不含参数信息,参数 diff 由 ParameterDiffEngine 负责 */
|
||||
public static String buildFingerprint(String sourceFile, String methodName) {
|
||||
return sourceFile + "#" + methodName;
|
||||
}
|
||||
|
||||
public String getFingerprint() {
|
||||
|
||||
@@ -53,11 +53,6 @@ public class MethodParameterSnapshot {
|
||||
return dtoClassName;
|
||||
}
|
||||
|
||||
/** 接口指纹槽位:序号 + 参数来源,不含类型与绑定名,避免类型/绑定变更导致误配对 */
|
||||
public String fingerprintSlotKey(int index) {
|
||||
return index + ":" + source;
|
||||
}
|
||||
|
||||
/** path/query 按绑定名匹配,避免仅 Java 形参重命名误报 */
|
||||
public String identityKey() {
|
||||
if ("path".equals(source) || "query".equals(source)) {
|
||||
|
||||
@@ -127,7 +127,7 @@ public class ApiChangeNotifier {
|
||||
sb.append("# 【API参数变更通知】").append("\n\n");
|
||||
sb.append(MarkdownStyles.quoteKvBold("修改人", MarkdownStyles.colorComment(modifier))).append("\n");
|
||||
sb.append(MarkdownStyles.quoteKvBold("时间", MarkdownStyles.colorComment(modifyTime))).append("\n");
|
||||
sb.append(MarkdownStyles.quoteKvBold("变更类型", MarkdownStyles.colorWarning("修改参数"))).append("\n");
|
||||
//sb.append(MarkdownStyles.quoteKvBold("变更类型", MarkdownStyles.colorWarning("修改参数"))).append("\n");
|
||||
sb.append(MarkdownStyles.quoteKvBold("URI",
|
||||
MarkdownStyles.colorInfo(report.getHttpMethod()) + " "
|
||||
+ MarkdownStyles.inlineCode(report.getUri()))).append("\n");
|
||||
|
||||
@@ -93,7 +93,7 @@ public class EndpointSnapshotParser {
|
||||
List<String> httpMethods = extractHttpMethods(annotation, annName);
|
||||
List<MethodParameterSnapshot> params = extractParameters(method);
|
||||
String methodDescription = MethodDescriptionExtractor.extract(method);
|
||||
String fingerprint = EndpointSnapshot.buildFingerprint(sourceFile, method.getNameAsString(), params);
|
||||
String fingerprint = EndpointSnapshot.buildFingerprint(sourceFile, method.getNameAsString());
|
||||
for (String httpMethod : httpMethods) {
|
||||
for (String subPath : subPaths) {
|
||||
String uri = joinPaths(basePath, subPath);
|
||||
|
||||
Reference in New Issue
Block a user