Merge branch 'dev' into torna

# Conflicts:
#	src/main/java/com/power/doc/builder/OpenApiBuilder.java
This commit is contained in:
oppofind 2021-03-11 22:27:05 +08:00
commit 900300dace
4 changed files with 7 additions and 7 deletions

View File

@ -65,7 +65,7 @@
<dependency>
<groupId>com.github.shalousun</groupId>
<artifactId>common-util</artifactId>
<version>2.0.5</version>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>

View File

@ -29,12 +29,10 @@ import com.power.common.util.FileUtil;
import com.power.common.util.StringUtil;
import com.power.doc.constants.DocGlobalConstants;
import com.power.doc.constants.Methods;
import com.power.doc.constants.TornaConstants;
import com.power.doc.model.*;
import com.power.doc.template.SpringBootDocBuildTemplate;
import com.power.doc.utils.DocUtil;
import com.thoughtworks.qdox.JavaProjectBuilder;
import jdk.nashorn.internal.runtime.GlobalConstants;
import java.util.*;
@ -283,7 +281,7 @@ public class OpenApiBuilder {
/**
* content body 的schema 信息
*
* @param apiMethodDoc 请求方法参数
* @param apiMethodDoc 请求方法参数 去除server
* @param isRep 是否是返回数据
* @return
*/
@ -297,8 +295,8 @@ public class OpenApiBuilder {
String requestRef = "#/components/schemas/" + apiMethodDoc.getPath().replaceAll(PATH_REGEX, "_") + "request";
//如果是数组类型
if(TornaConstants.ARRAY.equals(apiMethodDoc.getType())){
schema.put("type",TornaConstants.ARRAY);
if(DocGlobalConstants.ARRAY.equals(apiMethodDoc.getType())){
schema.put("type",DocGlobalConstants.ARRAY);
if (isRep) {
innerScheme.put("$ref", responseRef);
} else {

View File

@ -200,4 +200,6 @@ public interface DocGlobalConstants {
String YAPI_JSON = "/yapi.json";
String DUBBO_SWAGGER = "org.apache.dubbo.rpc.protocol.rest.integration.swagger.DubboSwaggerApiListingResource";
String ARRAY = "array";
}

View File

@ -163,7 +163,7 @@ public class JsonBuildHelper {
data.append("{\"mapKey\":{}}");
return data.toString();
}
if (!DocGlobalConstants.JAVA_STRING_FULLY.equals(getKeyValType[0])) {
if ((!DocGlobalConstants.JAVA_STRING_FULLY.equals(getKeyValType[0])) && apiConfig.isStrict()) {
throw new RuntimeException("Map's key can only use String for json,but you use " + getKeyValType[0]);
}
String gicName = gNameTemp.substring(gNameTemp.indexOf(",") + 1, gNameTemp.lastIndexOf(">"));