Update README_CN.md

This commit is contained in:
shalousun 2021-06-27 01:14:49 +08:00
parent b50f84f142
commit 777eab2fcd
4 changed files with 64 additions and 12 deletions

View File

@ -1,5 +1,20 @@
## smart-doc版本
#### 版本号2.2.2
- 更新日期: 2020-07-01
- 更新内容:
1. 修复url中遇到正则表达解析错误问题.
2. 修复生成的json样例部分格式化后错误的bug,gitee #I3XSE5
3. 增强对文档中html特殊字符的处理防止html渲染后显示错误gitee #I3XO31
4. 请求头设置增强支持配置urlPatterns去匹配对应的接口。
#### 版本号2.2.1
- 更新日期: 2020-06-20
- 更新内容:
1. 移除代码中System.out.print打印.
#### 版本号2.2.0
- 更新日期: 2020-06-20

View File

@ -188,6 +188,14 @@ smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc
"value":"token请求头的值",//不设置默认null
"required": false,//是否必须
"since": "-"//什么版本添加的改请求头
},{
"name": "appkey",//请求头
"type": "string",//请求头类型
"desc": "desc",//请求头描述信息
"value":"appkey请求头的值",//不设置默认null
"required": false,//是否必须
"urlPatterns": "/test/add;/testConstants/1.0",//正则表达式过滤请求头,url匹配上才会添加该请求头多个正则用分号隔开
"since": "-"//什么版本添加的改请求头
}],
"rpcApiDependencies":[{ // 项目开放的dubbo api接口模块依赖配置后输出到文档方便使用者集成
"artifactId":"SpringBoot2-Dubbo-Api",
@ -299,7 +307,7 @@ the [LICENSE](https://gitee.com/smart-doc-team/smart-doc/blob/master/LICENSE) fi
![IFLYTEK](https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/iflytek.png)
&nbsp;&nbsp;<img src="https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/oneplus.png" title="一加" width="83px" height="83px"/>
&nbsp;&nbsp;<img src="https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/xiaomi.png" title="小米" width="170px" height="83px"/>
&nbsp;&nbsp;<img src="https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/neusoft.png" title="东软集团" width="170px" height="83px"/>
&nbsp;&nbsp;<img src="https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/neusoft.png" title="东软集团" width="180px" height="83px"/>
&nbsp;&nbsp;<img src="https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/zhongkezhilian.png" title="中科智链" width="272px" height="83px"/>
<img src="https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/yuanmengjiankang.png" title="远盟健康" width="260px" height="83px"/>
<img src="https://gitee.com/smart-doc-team/smart-doc/raw/master/images/known-users/puqie_gaitubao_100x100.jpg" title="普切信息科技" width="83px" height="83px"/>

View File

@ -44,7 +44,6 @@ import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.power.doc.constants.DocAnnotationConstants.MAX;
import static com.power.doc.constants.DocGlobalConstants.*;
import static com.power.doc.constants.DocTags.IGNORE;
import static com.power.doc.constants.DocTags.IGNORE_REQUEST_BODY_ADVICE;
@ -204,8 +203,8 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
apiMethodDoc.setDeprecated(requestMapping.isDeprecated());
List<JavaParameter> javaParameters = method.getParameters();
setTornaArrayTags(javaParameters,apiMethodDoc, docJavaMethod.getJavaMethod().getReturns());
// apiMethodDoc.setIsRequestArray();
setTornaArrayTags(javaParameters, apiMethodDoc, docJavaMethod.getJavaMethod().getReturns());
// apiMethodDoc.setIsRequestArray();
ApiMethodReqParam apiMethodReqParam = requestParams(docJavaMethod, projectBuilder);
// build request params
if (paramsDataToTree) {
@ -227,7 +226,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
}
allApiReqHeaders.removeIf(apiReqHeader -> {
if (StringUtil.isNotEmpty(apiReqHeader.getUrlPatterns())) {
return requestMapping.getShortUrl().matches(apiReqHeader.getUrlPatterns());
return !PathUtil.isMatchUrl(requestMapping.getShortUrl(), apiReqHeader.getUrlPatterns());
}
return false;
});
@ -992,14 +991,13 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
//formData - multiple data
if (!hasRequestBody && javaParameters.size() > 1) {
return;
}
else {
} else {
apiMethodDoc.setIsRequestArray(1);
if (JavaClassValidateUtil.isPrimitive(gicType)) {
apiMethodDoc.setRequestArrayType(simpleGicType);
} else {
apiMethodDoc.setRequestArrayType(OBJECT);
}
if (JavaClassValidateUtil.isPrimitive(gicType)) {
apiMethodDoc.setRequestArrayType(simpleGicType);
} else {
apiMethodDoc.setRequestArrayType(OBJECT);
}
}
}
}

View File

@ -26,6 +26,8 @@ import com.power.common.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.*;
import java.util.regex.Pattern;
public class PathUtil {
@ -61,4 +63,33 @@ public class PathUtil {
}
return null;
}
/**
* match
* @param url url
* @param urlPatterns patterns
* @return true if match
*/
public static boolean isMatchUrl(String url , String urlPatterns){
List<String> urlPatternList;
if (StringUtil.isNotEmpty(urlPatterns)) {
urlPatternList = Arrays.asList(urlPatterns.split(";", 0));
} else {
return false;
}
for (String str : urlPatternList) {
if (str.endsWith("/*")) {
String name = str.substring(0, str.length() - 1);
if (url.contains(name)) {
return true;
}
} else {
Pattern pattern = Pattern.compile(str);
if (pattern.matcher(url).matches()) {
return true;
}
}
}
return false;
}
}