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(",");