修复文档显示问题

1.x
tanghc 5 years ago
parent efc241adac
commit b5a06b9faf
  1. 13
      sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java

@ -203,7 +203,18 @@ public class SwaggerDocParser implements DocParser {
String ref = Optional.ofNullable(docInfo.getJSONObject("responses")) String ref = Optional.ofNullable(docInfo.getJSONObject("responses"))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("200"))) .flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("200")))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("schema"))) .flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("schema")))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getString("originalRef"))) .flatMap(jsonObject -> {
// #/definitions/Category
String $ref = jsonObject.getString("$ref");
if ($ref == null) {
return Optional.empty();
}
int index = $ref.lastIndexOf("/");
if (index > -1) {
$ref = $ref.substring(index + 1);
}
return Optional.of($ref);
})
.orElse(""); .orElse("");
return ref; return ref;
} }

Loading…
Cancel
Save