From 62160484f1b0f6273614eb9873c87e10080dee25 Mon Sep 17 00:00:00 2001 From: zhangjc Date: Thu, 24 Nov 2022 19:58:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/csap/framework/apidoc/web/CsapDocController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java b/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java index 7eb9743..6cf7462 100644 --- a/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java +++ b/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java @@ -92,8 +92,12 @@ public class CsapDocController { return apidoc(Boolean.FALSE) .getApiList() .stream() - .filter(item -> item.getName().equals(name)).collect(Collectors.toList()).get(0) - .getMethodList().stream().filter(item -> item.getKey().equals(key)).findFirst() + .filter(item -> item.getName().equals(name)) + .findFirst() + .orElseThrow() + .getMethodList() + .stream() + .filter(item -> item.getKey().equals(key)).findFirst() .map(i -> CsapDocMethodResponse.builder() .headers(BeanCopierUtil.copyList(i.getMethodHeaders(), MethodHeadersResponseModel.class)) .patch("/" + i.getApiPath()[0] + "/" + i.getPaths()[0]) -- Gitee From 1c3725ad33c6dcc46c13ef8837a006a0138b2695 Mon Sep 17 00:00:00 2001 From: zhangjc Date: Mon, 5 Dec 2022 14:48:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csap/framework/apidoc/response/CsapDocParentResponse.java | 3 +++ .../java/com/csap/framework/apidoc/web/CsapDocController.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/response/CsapDocParentResponse.java b/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/response/CsapDocParentResponse.java index 7ecb4a0..51ae9c1 100644 --- a/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/response/CsapDocParentResponse.java +++ b/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/response/CsapDocParentResponse.java @@ -1,6 +1,7 @@ package com.csap.framework.apidoc.response; import com.csap.framework.annotation.apidoc.ApiModel; +import com.csap.framework.apidoc.model.CsapDocResource; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -27,5 +28,7 @@ public class CsapDocParentResponse { */ private List apiList; + private List resources; + } diff --git a/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java b/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java index 6cf7462..8de4dbb 100644 --- a/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java +++ b/csap-framework-apidoc-core/src/main/java/com/csap/framework/apidoc/web/CsapDocController.java @@ -80,8 +80,10 @@ public class CsapDocController { @GetMapping("/apidoc/parent") public CsapDocParentResponse apiDocParent() { + CsapDocResponse apiDoc = apidoc(Boolean.FALSE); return CsapDocParentResponse.builder() - .apiList(apidoc(Boolean.FALSE).getApiList().stream().map(item -> CsapDocParentResponseModel.builder() + .resources(apiDoc.getResources()) + .apiList(apiDoc.getApiList().stream().map(item -> CsapDocParentResponseModel.builder() .title(item.getValue()) .key(item.getName()) .children(setChildren(item.getMethodList(), item.getProtocols().name())).build()).collect(Collectors.toList())).build(); -- Gitee