From b0dc00ede7b1e54485b9ecd784f55a9877dd1a7a Mon Sep 17 00:00:00 2001 From: oppofind <836575280@qq.com> Date: Tue, 29 Sep 2020 10:13:22 +0800 Subject: [PATCH] Change the default value of server url. --- .../doc/constants/DocGlobalConstants.java | 2 +- .../power/doc/helper/ParamsBuildHelper.java | 8 ++++--- .../java/com/power/doc/utils/Iterables.java | 23 +++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/power/doc/constants/DocGlobalConstants.java b/src/main/java/com/power/doc/constants/DocGlobalConstants.java index fddda89..06e8a94 100644 --- a/src/main/java/com/power/doc/constants/DocGlobalConstants.java +++ b/src/main/java/com/power/doc/constants/DocGlobalConstants.java @@ -133,7 +133,7 @@ public interface DocGlobalConstants { String SHORT_MULTIPART_FILE_FULLY = "MultipartFile"; - String DEFAULT_SERVER_URL = "http://{server}"; + String DEFAULT_SERVER_URL = ""; String SHORT_REQUEST_BODY = "RequestBody"; diff --git a/src/main/java/com/power/doc/helper/ParamsBuildHelper.java b/src/main/java/com/power/doc/helper/ParamsBuildHelper.java index 8e84ffc..3129391 100644 --- a/src/main/java/com/power/doc/helper/ParamsBuildHelper.java +++ b/src/main/java/com/power/doc/helper/ParamsBuildHelper.java @@ -198,7 +198,8 @@ public class ParamsBuildHelper { //cover comment CustomRespField customResponseField = responseFieldMap.get(field.getName()); String comment; - if (null != customResponseField && StringUtil.isNotEmpty(customResponseField.getDesc())) { + if (null != customResponseField && StringUtil.isNotEmpty(customResponseField.getDesc()) + && simpleName.equals(customResponseField.getOwnerClassName())) { comment = customResponseField.getDesc(); } else { comment = docField.getComment(); @@ -251,7 +252,7 @@ public class ParamsBuildHelper { if (displayActualType) { if (globGicName.length > 0) { String gicName = genericMap.get(subTypeName) != null ? genericMap.get(subTypeName) : globGicName[0]; - if(!simpleName.equals(gicName)){ + if (!simpleName.equals(gicName)) { appendComment = " (ActualType: " + JavaClassUtil.getClassSimpleName(gicName) + ")"; } } @@ -428,7 +429,8 @@ public class ParamsBuildHelper { return paramList; } - private static void commonHandleParam(List paramList, ApiParam param, String isRequired, String comment, String since, boolean strRequired) { + private static void commonHandleParam(List paramList, ApiParam param, String isRequired, + String comment, String since, boolean strRequired) { if (StringUtil.isEmpty(isRequired)) { param.setDesc(comment).setVersion(since); } else { diff --git a/src/main/java/com/power/doc/utils/Iterables.java b/src/main/java/com/power/doc/utils/Iterables.java index 808ba86..e30ceb1 100644 --- a/src/main/java/com/power/doc/utils/Iterables.java +++ b/src/main/java/com/power/doc/utils/Iterables.java @@ -1,3 +1,26 @@ +/* + * smart-doc + * + * Copyright (C) 2018-2020 smart-doc + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package com.power.doc.utils; import java.util.function.BiConsumer;