Skip to content

Commit

Permalink
release 1.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
shalousun committed Apr 19, 2020
1 parent acb6147 commit e7e17d6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 31 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Thanks to the following people who have submitted major pull requests:
- [@qinkangdeid](https://github.com/qinkangdeid)
- [@br7roy](https://github.com/br7roy)
- [@caiqyxyx](https://gitee.com/cy-work)
- [@lichoking](https://gitee.com/lichoking)
## Other reference
- [Smart-doc manual](https://github.com/shalousun/smart-doc/wiki)

Expand Down
1 change: 1 addition & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ mvn clean install -Dmaven.test.skip=true
- [@qinkangdeid](https://github.com/qinkangdeid)
- [@br7roy](https://github.com/br7roy)
- [@caiqyxyx](https://gitee.com/cy-work)
- [@lichoking](https://gitee.com/lichoking)
## Other reference
- [smart-doc功能使用介绍](https://my.oschina.net/u/1760791/blog/2250962)
- [smart-doc官方wiki](https://gitee.com/sunyurepository/smart-doc/wikis/Home?sort_id=1652800)
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>smart-doc</artifactId>
<packaging>jar</packaging>
<version>1.8.4</version>
<version>1.8.5</version>

<name>smart-doc</name>
<url>https://github.com/shalousun/smart-doc.git</url>
<description>smart-doc</description>
<description>smart-doc is a java restful api document generation tool.</description>

<licenses>
<license>
Expand Down Expand Up @@ -38,7 +38,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -59,7 +59,7 @@
<dependency>
<groupId>com.github.shalousun</groupId>
<artifactId>common-util</artifactId>
<version>1.9.2</version>
<version>1.9.3</version>
</dependency>
<!--markdown to html-->
<dependency>
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/power/doc/filter/WebFluxReturnFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
*/
public class WebFluxReturnFilter implements ReturnTypeFilter {

private static final String FLUX = "reactor.core.publisher.Flux";

@Override
public ApiReturn doFilter(String fullyName) {
//support web flux
if (fullyName.startsWith("reactor.core.publisher.Flux")) {
if (fullyName.startsWith(FLUX)) {
ApiReturn apiReturn = new ApiReturn();
// rewrite type name
fullyName = fullyName.replace("reactor.core.publisher.Flux", DocGlobalConstants.JAVA_LIST_FULLY);
fullyName = fullyName.replace(FLUX, DocGlobalConstants.JAVA_LIST_FULLY);
apiReturn.setGenericCanonicalName(fullyName);
apiReturn.setSimpleName(DocGlobalConstants.JAVA_LIST_FULLY);
return apiReturn;
Expand Down
27 changes: 2 additions & 25 deletions src/main/java/com/power/doc/utils/DocUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import org.apache.commons.codec.digest.DigestUtils;

import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
Expand All @@ -52,8 +50,6 @@ public class DocUtil {

private static String CLASS_PATTERN = "^([A-Za-z]{1}[A-Za-z\\d_]*\\.)+[A-Za-z][A-Za-z\\d_]*$";

public static final String CONTAINS_CHINESE_PATTERN = "[\u4E00-\u9FA5|\\!|\\,|\\。|\\(|\\)|\\《|\\》|\\“|\\”|\\?|\\:|\\;|\\【|\\】]";

private static Map<String, String> fieldValue = new LinkedHashMap<>();

static {
Expand Down Expand Up @@ -144,7 +140,6 @@ public static String jsonValueByType(String typeName) {
*/
public static String getValByTypeAndFieldName(String typeName, String filedName) {
boolean isArray = true;

String type = typeName.contains("java.lang") ? typeName.substring(typeName.lastIndexOf(".") + 1, typeName.length()) : typeName;
String key = filedName.toLowerCase() + "-" + type.toLowerCase();
StringBuilder value = null;
Expand Down Expand Up @@ -201,7 +196,7 @@ public static boolean isClassName(String className) {
if (StringUtil.isEmpty(className) || !className.contains(".")) {
return false;
}
if (isContainsChinese(className)) {
if (ValidateUtil.isContainsChinese(className)) {
return false;
}
String classNameTemp = className;
Expand Down Expand Up @@ -438,7 +433,7 @@ public static Map<String, String> formDataToMap(List<FormData> formDataList) {
return formDataMap;
}

private static boolean javaPrimaryType(String type) {
public static boolean javaPrimaryType(String type) {
switch (type) {
case "Integer":
case "int":
Expand All @@ -459,22 +454,4 @@ private static boolean javaPrimaryType(String type) {
return false;
}
}

/**
* contains chinese
*
* @param str str
* @return boolean
*/
public static boolean isContainsChinese(String str) {
if (StringUtil.isEmpty(str)) {
return true;
}
Pattern p = Pattern.compile(CONTAINS_CHINESE_PATTERN);
Matcher m = p.matcher(str);
if (m.find()) {
return true;
}
return false;
}
}

0 comments on commit e7e17d6

Please sign in to comment.