diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d7a2162..d77fc67f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
## smart-doc版本
版本小于1.0都属于试用,正式1.0起始发布将会等到文中提到的问题解决后才发布。
+#### 版本号:2.0.6
+- 更新日期: 2020-01-15
+- 更新内容:
+ 1. 修复带正则的path路径参数在postman中用例问题。
+ 2. 增强对祖传不良代码的分析兼容。
#### 版本号:2.0.5
- 更新日期: 2020-01-09
- 更新内容:
diff --git a/pom.xml b/pom.xml
index 144568bb..2e54a090 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
smart-doc
jar
- 2.0.5
+ 2.0.6
smart-doc
https://github.com/smart-doc-group/smart-doc.git
diff --git a/src/main/java/com/power/doc/utils/DocUtil.java b/src/main/java/com/power/doc/utils/DocUtil.java
index 6bad6814..c7c019ee 100644
--- a/src/main/java/com/power/doc/utils/DocUtil.java
+++ b/src/main/java/com/power/doc/utils/DocUtil.java
@@ -23,6 +23,7 @@
package com.power.doc.utils;
import com.github.javafaker.Faker;
+import com.mifmif.common.regex.Generex;
import com.power.common.util.*;
import com.power.doc.constants.DocAnnotationConstants;
import com.power.doc.constants.DocGlobalConstants;
@@ -33,6 +34,7 @@
import com.thoughtworks.qdox.model.JavaField;
import com.thoughtworks.qdox.model.JavaMethod;
import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
@@ -248,6 +250,24 @@ public static boolean isMatch(String packageFilters, String controllerName) {
* @return formatted string
*/
public static String formatAndRemove(String str, Map values) {
+ // /detail/{id:[a-zA-Z0-9]{3}}/{name:[a-zA-Z0-9]{3}}
+ if (str.indexOf(":") >= 0) {
+ String[] strArr = str.split("/");
+ for (int i = 0; i < strArr.length; i++) {
+ if (strArr[i].indexOf(":") >= 0) {
+ String reg = strArr[i].substring(strArr[i].indexOf(":") + 1, strArr[i].length() - 1);
+ Generex generex = new Generex(reg);
+ // Generate random String
+ String randomStr = generex.random();
+ String key = strArr[i].substring(1, strArr[i].indexOf(":"));
+ if (values.containsKey(key)) {
+ values.put(key, randomStr);
+ }
+ strArr[i] = strArr[i].substring(0, strArr[i].indexOf(":")) + "}";
+ }
+ }
+ str = StringUtils.join(Arrays.asList(strArr), '/');
+ }
StringBuilder builder = new StringBuilder(str);
Set> entries = values.entrySet();
Iterator> iteratorMap = entries.iterator();
@@ -459,7 +479,7 @@ public static boolean javaPrimaryType(String type) {
}
}
- public static String javaTypeToOpenApiTypeConvert(String type){
+ public static String javaTypeToOpenApiTypeConvert(String type) {
switch (type) {
case "int32":
case "int16":