Merge pull request #100 from cogitarebis/master
feat(Render RequestParam): fixed unable to render RequetParam
This commit is contained in:
commit
c95eafe199
|
@ -183,6 +183,9 @@ public class JsonBuildHelper {
|
|||
} else if (DocGlobalConstants.JAVA_OBJECT_FULLY.equals(typeName)) {
|
||||
data.append("{\"object\":\" any object\"},");
|
||||
// throw new RuntimeException("Please do not return java.lang.Object directly in api interface.");
|
||||
} else if(JavaClassValidateUtil.isReactor(typeName)) {
|
||||
data.append(buildJson(globGicName[0], typeName, isResp, nextLevel, registryClasses, builder));
|
||||
return data.toString();
|
||||
} else {
|
||||
boolean requestFieldToUnderline = builder.getApiConfig().isRequestFieldToUnderline();
|
||||
boolean responseFieldToUnderline = builder.getApiConfig().isResponseFieldToUnderline();
|
||||
|
|
|
@ -109,7 +109,10 @@ public class ParamsBuildHelper {
|
|||
param.setDesc(DocGlobalConstants.ANY_OBJECT_MSG).setRequired(false).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
}
|
||||
paramList.add(param);
|
||||
} else {
|
||||
} else if (JavaClassValidateUtil.isReactor(simpleName)) {
|
||||
paramList.addAll(buildParams(globGicName[0], pre, nextLevel, isRequired, responseFieldMap, isResp,
|
||||
registryClasses, projectBuilder, groupClasses, pid));
|
||||
}else {
|
||||
out:
|
||||
for (DocJavaField docField : fields) {
|
||||
JavaField field = docField.getJavaField();
|
||||
|
|
|
@ -42,24 +42,24 @@ public class DocClassUtil {
|
|||
/**
|
||||
* get class names by generic class name
|
||||
*
|
||||
* @param returnType generic class name
|
||||
* @param typeName generic class name
|
||||
* @return array of string
|
||||
*/
|
||||
public static String[] getSimpleGicName(String returnType) {
|
||||
if (JavaClassValidateUtil.isCollection(returnType)) {
|
||||
returnType = returnType + "<T>";
|
||||
} else if (JavaClassValidateUtil.isArray(returnType)) {
|
||||
returnType = returnType.substring(0, returnType.lastIndexOf("["));
|
||||
returnType = "java.util.List<" + returnType + ">";
|
||||
} else if (JavaClassValidateUtil.isMap(returnType)) {
|
||||
returnType = returnType + "<String,T>";
|
||||
public static String[] getSimpleGicName(String typeName) {
|
||||
if (JavaClassValidateUtil.isCollection(typeName)) {
|
||||
typeName = typeName + "<T>";
|
||||
} else if (JavaClassValidateUtil.isArray(typeName)) {
|
||||
typeName = typeName.substring(0, typeName.lastIndexOf("["));
|
||||
typeName = "java.util.List<" + typeName + ">";
|
||||
} else if (JavaClassValidateUtil.isMap(typeName)) {
|
||||
typeName = typeName + "<String,T>";
|
||||
}
|
||||
if (returnType.contains("<")) {
|
||||
String pre = returnType.substring(0, returnType.indexOf("<"));
|
||||
if (typeName.contains("<")) {
|
||||
String pre = typeName.substring(0, typeName.indexOf("<"));
|
||||
if (JavaClassValidateUtil.isMap(pre)) {
|
||||
return getMapKeyValueType(returnType);
|
||||
return getMapKeyValueType(typeName);
|
||||
}
|
||||
String type = returnType.substring(returnType.indexOf("<") + 1, returnType.lastIndexOf(">"));
|
||||
String type = typeName.substring(typeName.indexOf("<") + 1, typeName.lastIndexOf(">"));
|
||||
if (JavaClassValidateUtil.isCollection(pre)) {
|
||||
return type.split(" ");
|
||||
}
|
||||
|
|
|
@ -272,4 +272,19 @@ public class JavaClassValidateUtil {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check reactor param
|
||||
* @param typeName
|
||||
* @return
|
||||
*/
|
||||
public static boolean isReactor(String typeName) {
|
||||
switch (typeName) {
|
||||
case "reactor.core.publisher.Mono":
|
||||
case "reactor.core.publisher.Flux":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue