From 0633ab5f9957d6f3e5f57c46a2069ac66a45b89c Mon Sep 17 00:00:00 2001 From: xingzi <1771761586@qq.com> Date: Sat, 28 Dec 2019 17:31:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9responseexample=20=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E5=AD=97=E6=AE=B5=E9=97=AE=E9=A2=98=20postman?= =?UTF-8?q?=E7=94=9F=E6=88=90URl=E4=B8=BA=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/power/doc/builder/PostmanJsonBuilder.java | 2 +- src/main/java/com/power/doc/helper/JsonBuildHelper.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/power/doc/builder/PostmanJsonBuilder.java b/src/main/java/com/power/doc/builder/PostmanJsonBuilder.java index 0e3bd73..e6f97f3 100644 --- a/src/main/java/com/power/doc/builder/PostmanJsonBuilder.java +++ b/src/main/java/com/power/doc/builder/PostmanJsonBuilder.java @@ -100,7 +100,7 @@ public class PostmanJsonBuilder { requestBean.setHeader(buildHeaderBeanList(apiMethodDoc)); requestBean.setBody(buildBodyBean(apiMethodDoc)); - requestBean.setUrl(apiMethodDoc.getRequestExample().getUrl()); + requestBean.setUrl(apiMethodDoc.getRequestExample().getUrl() == null ? apiMethodDoc.getUrl() : apiMethodDoc.getRequestExample().getUrl()); item.setRequest(requestBean); return item; diff --git a/src/main/java/com/power/doc/helper/JsonBuildHelper.java b/src/main/java/com/power/doc/helper/JsonBuildHelper.java index 4dca440..a6de079 100644 --- a/src/main/java/com/power/doc/helper/JsonBuildHelper.java +++ b/src/main/java/com/power/doc/helper/JsonBuildHelper.java @@ -51,6 +51,7 @@ public class JsonBuildHelper { */ public static String buildJson(String typeName, String genericCanonicalName, boolean isResp, int counter, Map registryClasses, ProjectDocConfigBuilder builder) { + JavaClass javaClass = builder.getJavaProjectBuilder().getClassByName(typeName); if (registryClasses.containsKey(typeName) && counter > registryClasses.size()) { return "{\"$ref\":\"...\"}"; } @@ -65,6 +66,9 @@ public class JsonBuildHelper { if (JavaClassValidateUtil.isPrimitive(typeName)) { return StringUtil.removeQuotes(DocUtil.jsonValueByType(typeName)); } + if(javaClass.isEnum()){ + return String.valueOf(JavaClassUtil.getEnumValue(javaClass, Boolean.FALSE)); + } StringBuilder data0 = new StringBuilder(); JavaClass cls = builder.getClassByName(typeName); data0.append("{"); @@ -286,7 +290,7 @@ public class JsonBuildHelper { } else if (typeName.equals(subTypeName)) { data0.append("{\"$ref\":\"...\"}").append(","); } else { - JavaClass javaClass = builder.getJavaProjectBuilder().getClassByName(subTypeName); + javaClass = builder.getJavaProjectBuilder().getClassByName(subTypeName); if (!isResp && javaClass.isEnum()) { Object value = JavaClassUtil.getEnumValue(javaClass, Boolean.FALSE); data0.append(value).append(",");