mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
修复Optional.of异常问题
This commit is contained in:
@@ -66,18 +66,6 @@ public class DocManagerImpl implements DocManager {
|
|||||||
ServiceInfoVO serviceInfoVo = entry.getValue().get(0);
|
ServiceInfoVO serviceInfoVo = entry.getValue().get(0);
|
||||||
loadDocInfo(serviceInfoVo);
|
loadDocInfo(serviceInfoVo);
|
||||||
}
|
}
|
||||||
// Map<String, DocItem> itemMap = docDefinitionMap.values()
|
|
||||||
// .stream()
|
|
||||||
// .map(DocInfo::getDocModuleList)
|
|
||||||
// .map(list->{
|
|
||||||
// for (DocModule docModule : list) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// .map(DocModule::getDocItems)
|
|
||||||
// .flatMap(docItems -> docItems.stream())
|
|
||||||
// .collect(Collectors.toMap(DocItem::getNameVersion, Function.identity()));
|
|
||||||
// this.docItemMap.putAll(itemMap);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("加载失败", e);
|
log.error("加载失败", e);
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,8 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 解析swagger的json内容
|
||||||
|
*
|
||||||
* @author tanghc
|
* @author tanghc
|
||||||
*/
|
*/
|
||||||
public class SwaggerDocParser implements DocParser {
|
public class SwaggerDocParser implements DocParser {
|
||||||
@@ -103,10 +105,11 @@ public class SwaggerDocParser implements DocParser {
|
|||||||
|
|
||||||
protected String getResponseRef(JSONObject docInfo) {
|
protected String getResponseRef(JSONObject docInfo) {
|
||||||
String ref = Optional.ofNullable(docInfo.getJSONObject("responses"))
|
String ref = Optional.ofNullable(docInfo.getJSONObject("responses"))
|
||||||
.flatMap(jsonObject -> Optional.of(jsonObject.getJSONObject("200")))
|
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("200")))
|
||||||
.flatMap(jsonObject -> Optional.of(jsonObject.getJSONObject("schema")))
|
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("schema")))
|
||||||
.flatMap(jsonObject -> Optional.of(jsonObject.getString("originalRef")))
|
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getString("originalRef")))
|
||||||
.orElse("");
|
.orElse("");
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user