修复生成openApi3.0.json时,相同链接不同提交方法生成错误

This commit is contained in:
XlouC 2020-10-05 01:22:27 +08:00 committed by GitHub
parent 687fe17ddc
commit 6a226f1448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -108,7 +108,15 @@ public class OpenApiBuilder {
apiMethodDocs.forEach(
method -> {
//设置paths的请求url 将双斜杠替换成单斜杠
pathMap.put(method.getPath().replace("//", "/"), buildPathUrls(method, a));
String url = method.getPath().replace("//", "/");
Map<String, Object> request = buildPathUrls(method, a);
//pathMap.put(method.getPath().replace("//", "/"), buildPathUrls(method, a));
if (!pathMap.containsKey(url)) {
pathMap.put(url, request);
} else {
Map<String, Object> oldRequest = (Map<String, Object>) pathMap.get(url);
oldRequest.putAll(request);
}
}
);
}