修改apidocTest配置 修复@mock 标记的map时未推送到torna问题

This commit is contained in:
Forget 2021-07-18 15:26:04 +08:00
parent 30999e0489
commit 11c775a2b0
2 changed files with 26 additions and 7 deletions

View File

@ -31,10 +31,7 @@ import com.power.doc.constants.DocGlobalConstants;
import com.power.doc.constants.DocTags;
import com.power.doc.constants.ValidatorAnnotations;
import com.power.doc.model.*;
import com.power.doc.utils.DocClassUtil;
import com.power.doc.utils.DocUtil;
import com.power.doc.utils.JavaClassUtil;
import com.power.doc.utils.JavaClassValidateUtil;
import com.power.doc.utils.*;
import com.thoughtworks.qdox.model.JavaAnnotation;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaField;
@ -350,6 +347,16 @@ public class ParamsBuildHelper {
} else if (JavaClassValidateUtil.isCollection(subTypeName) || JavaClassValidateUtil.isArray(subTypeName)) {
param.setType("array");
if (tagsMap.containsKey(DocTags.MOCK) && StringUtil.isNotEmpty(tagsMap.get(DocTags.MOCK))) {
param.setValue(fieldValue);
if (StringUtil.isNotEmpty(comment)) {
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
} else {
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
}
continue;
}
if (globGicName.length > 0 && "java.util.List".equals(fieldGicName)) {
fieldGicName = fieldGicName + "<T>";
}
@ -414,6 +421,17 @@ public class ParamsBuildHelper {
}
} else if (JavaClassValidateUtil.isMap(subTypeName)) {
if (tagsMap.containsKey(DocTags.MOCK) && StringUtil.isNotEmpty(tagsMap.get(DocTags.MOCK))) {
param.setType("map");
param.setValue(fieldValue);
if (StringUtil.isNotEmpty(comment)) {
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
} else {
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
}
continue;
}
if (StringUtil.isNotEmpty(comment)) {
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
} else {

View File

@ -31,14 +31,15 @@ public class ApiDocTest {
config.setServerUrl("http://127.0.0.1:8899");
//config.setStrict(true);
config.setOpenUrl("http://demo.torna.cn/api");
config.setAppKey("20201216788835306945118208");
config.setAppToken("258e853573d44ef4a3e2caebdcafbc0f");
config.setSecret("W.ZyGMOB9Q0UqujVxnfi@.I#V&tUUYZR");
config.setAppKey("20210617855226428617129984");
config.setAppToken("b3e291ed6a75452f9a467d420583082c");
config.setSecret("^^As.tU#XpK=FATTpY<Vj0PFLt9iak!2");
config.setDebugEnvName("测试环境");
// config.setAuthor("test");
config.setDebugEnvUrl("http://127.0.0.1");
//config.setTornaDebug(true);
config.setCreateDebugPage(true);
config.setAllInOne(true);
config.setOutPath("d:\\md3");
config.setMd5EncryptedHtmlName(true);