修复文档显示BUG

This commit is contained in:
tanghc
2019-11-26 16:51:01 +08:00
parent 2e88574284
commit d6eef1218e
7 changed files with 64 additions and 13 deletions

View File

@@ -8,6 +8,7 @@ import com.gitee.sop.websiteserver.bean.DocModule;
import com.gitee.sop.websiteserver.bean.DocParameter;
import com.gitee.sop.websiteserver.bean.DocParserContext;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
@@ -48,6 +49,9 @@ public class SwaggerDocParser implements DocParser {
String method = first.get();
JSONObject docInfo = pathInfo.getJSONObject(method);
DocItem docItem = buildDocItem(docInfo, docRoot);
if (docItem == null) {
continue;
}
if (docItem.isUploadRequest()) {
docItem.setHttpMethodList(Sets.newHashSet("post"));
} else {
@@ -103,8 +107,13 @@ public class SwaggerDocParser implements DocParser {
}
protected DocItem buildDocItem(JSONObject docInfo, JSONObject docRoot) {
String apiName = docInfo.getString("sop_name");
// 非开放接口
if (StringUtils.isBlank(apiName)) {
return null;
}
DocItem docItem = new DocItem();
docItem.setName(docInfo.getString("sop_name"));
docItem.setName(apiName);
docItem.setVersion(docInfo.getString("sop_version"));
docItem.setSummary(docInfo.getString("summary"));
docItem.setDescription(docInfo.getString("description"));