Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Commit b9f5a1b

Browse files
committed
upgrade smart-doc to 1.8.9
1 parent 9e56cce commit b9f5a1b

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ When you need to use smart-doc to generate more API document information, you ca
134134
"version":"1.0.0"
135135
}
136136
],
137+
"apiConstants": [{//Configure your own constant class, smart-doc automatically replaces with a specific value when parsing to a constant
138+
"constantsClassName": "com.power.doc.constants.RequestParamConstant"
139+
}],
137140
  "requestHeaders": [// Set global request headers, no need to set
138141
    {
139142
      "name": "token",

README_CN.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ subprojects{
132132
"since": "-"
133133
}
134134
],
135-
135+
"apiConstants": [{//从1.8.9开始配置自己的常量类,smart-doc在解析到常量时自动替换为具体的值
136+
"constantsClassName": "com.power.doc.constants.RequestParamConstant"
137+
}],
136138
"sourceCodePaths": [ //设置代码路径,默认加载src/main/java, 没有需求可以不设置
137139
{
138140
"path": "src/main/java",

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ plugins {
1515
}
1616

1717
group 'com.github.shalousun'
18-
version '1.1.0'
18+
version '1.1.1'
1919

2020
sourceCompatibility = 1.8
2121

src/main/java/com/smartdoc/gradle/util/GradleUtil.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
import com.google.gson.Gson;
2828
import com.google.gson.GsonBuilder;
2929
import com.power.common.util.FileUtil;
30-
import com.power.doc.model.ApiConfig;
31-
import com.power.doc.model.ApiDataDictionary;
32-
import com.power.doc.model.ApiErrorCodeDictionary;
33-
import com.power.doc.model.SourceCodePath;
30+
import com.power.doc.model.*;
3431
import org.apache.commons.lang3.StringUtils;
3532

3633
import java.io.File;
@@ -77,6 +74,7 @@ public static ApiConfig buildConfig(File configFile, Project project, Logger log
7774
ApiConfig apiConfig = GSON.fromJson(data, ApiConfig.class);
7875
List<ApiDataDictionary> apiDataDictionaries = apiConfig.getDataDictionaries();
7976
List<ApiErrorCodeDictionary> apiErrorCodes = apiConfig.getErrorCodeDictionaries();
77+
List<ApiConstant> apiConstants = apiConfig.getApiConstants();
8078
if (apiErrorCodes != null) {
8179
apiErrorCodes.forEach(
8280
apiErrorCode -> {
@@ -93,6 +91,14 @@ public static ApiConfig buildConfig(File configFile, Project project, Logger log
9391
}
9492
);
9593
}
94+
if (apiConstants != null) {
95+
apiConstants.forEach(
96+
apiConstant -> {
97+
String className = apiConstant.getConstantsClassName();
98+
apiConstant.setConstantsClass(getClassByClassName(className, classLoader));
99+
}
100+
);
101+
}
96102
addSourcePaths(project, apiConfig, log);
97103
return apiConfig;
98104
} catch (FileNotFoundException e) {

0 commit comments

Comments
 (0)