Skip to content

Commit

Permalink
release 2.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
shalousun committed Jan 15, 2021
1 parent a0311c5 commit 592f692
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
- 更新内容:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>smart-doc</artifactId>
<packaging>jar</packaging>
<version>2.0.5</version>
<version>2.0.6</version>

<name>smart-doc</name>
<url>https://github.com/smart-doc-group/smart-doc.git</url>
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/com/power/doc/utils/DocUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -248,6 +250,24 @@ public static boolean isMatch(String packageFilters, String controllerName) {
* @return formatted string
*/
public static String formatAndRemove(String str, Map<String, String> 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<Map.Entry<String, String>> entries = values.entrySet();
Iterator<Map.Entry<String, String>> iteratorMap = entries.iterator();
Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit 592f692

Please sign in to comment.