Skip to content

Commit

Permalink
release 2.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
shalousun committed May 30, 2021
1 parent 761edaf commit 8850c08
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
5. 修复父类是泛型时父类中LocalDateTime类型字段生成json样例错误。
6. 添加将接口排序order推送到torna中。
7. 修复类上的@ignore tag不生效bug.
8. 优化字典码推送,空字典码不会像torna发起推送请求。
#### 版本号:2.1.8

- 更新日期: 2020-05-22
Expand Down
19 changes: 8 additions & 11 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc
<!--格式为:groupId:artifactId;参考如下-->
<exclude>com.alibaba:fastjson</exclude>
</excludes>
<!--自1.0.8版本开始,插件提供includes支持-->
<!--自1.0.8版本开始,插件提供includes支持,配置了includes后插件会按照用户配置加载而不是自动加载,因此使用时需要注意-->
<!--smart-doc能自动分析依赖树加载所有依赖源码,原则上会影响文档构建效率,因此你可以使用includes来让插件加载你配置的组件-->
<includes>
<!--格式为:groupId:artifactId;参考如下-->
Expand Down Expand Up @@ -159,7 +159,7 @@ smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc
"codeField": "code",//错误码的code码字段名称
"descField": "message"//错误码的描述信息对应的字段名
}],
"revisionLogs": [{ //文档变更记录
"revisionLogs": [{ //文档变更记录,非必须
"version": "1.0", //文档版本号
"revisionTime": "2020-12-31 10:30", //文档修订时间
"status": "update", //变更操作状态,一般为:创建、更新等
Expand All @@ -173,7 +173,7 @@ smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc
"ownerClassName": "org.springframework.data.domain.Pageable", //指定你要添加注释的类名
"value": "00000"//设置响应码的值
}],
"customRequestFields": [{ //自定义请求体的注释,@since 2.1.3
"customRequestFields": [{ //自定义请求体的注释,@since 2.1.3,非必须
"name":"code", //属性名
"desc":"状态码", //描述
"ownerClassName":"com.xxx.constant.entity.Result", //属性对应的类全路径
Expand All @@ -199,23 +199,20 @@ smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc
"className": "org.springframework.data.domain.Pageable",
"replacementClassName": "com.power.doc.model.PageRequestDto" //自定义的PageRequestDto替换Pageable做文档渲染
}],
"apiConstants": [{//从1.8.9开始配置自己的常量类,smart-doc在解析到常量时自动替换为具体的值
"apiConstants": [{//从1.8.9开始配置自己的常量类,smart-doc在解析到常量时自动替换为具体的值,非必须
"constantsClassName": "com.power.doc.constants.RequestParamConstant"
}],
"responseBodyAdvice":{ //自smart-doc 1.9.8起,ResponseBodyAdvice统一返回设置,可用ignoreResponseBodyAdvice tag来忽略
"className":"com.power.common.model.CommonResult" //通用响应体
},
"requestBodyAdvice":{ ////自smart-doc 2.1.4 起,支持设置RequestBodyAdvice统一请求包装类
"requestBodyAdvice":{ ////自smart-doc 2.1.4 起,支持设置RequestBodyAdvice统一请求包装类,非必须
"className":"com.power.common.model.CommonResult"
},
"sourceCodePaths": [{ //设置代码路径, 插件已经能够自动下载发布的源码包,没必要配置
"path": "src/main/java",
"desc": "测试"
}]
}
}
```

上面的JSON配置实例中只有"outPath"是必填项。
>上面的JSON配置实例中只有"outPath"是必填项。其他额外配置项请根据实际情况来配置,胡乱复制上面的全配置到自己的项目中
可能引起使用错误

**注意:** 对于老用户完全可以通过`Fastjson`或者是`Gson`库将`ApiConfig`转化成JSON配置。

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>smart-doc</artifactId>
<packaging>jar</packaging>
<version>2.1.8</version>
<version>2.1.9</version>

<name>smart-doc</name>
<url>https://github.com/smart-doc-group/smart-doc.git</url>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/power/doc/builder/TornaBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static void buildApiDoc(ApiConfig config, JavaProjectBuilder javaProjectB
*
* @param apiDocs apiData
* @param apiConfig ApiConfig
* @param builder JavaProjectBuilder
* @param builder JavaProjectBuilder
*/
public static void buildTorna(List<ApiDoc> apiDocs, ApiConfig apiConfig, JavaProjectBuilder builder) {
TornaApi tornaApi = new TornaApi();
Expand All @@ -109,7 +109,7 @@ public static void buildTorna(List<ApiDoc> apiDocs, ApiConfig apiConfig, JavaPro
//推送字典信息
Map<String, Object> dicMap = new HashMap<>(2);
List<TornaDic> docDicts = TornaUtil.buildTornaDic(DocUtil.buildDictionary(apiConfig, builder));
if(CollectionUtil.isNotEmpty(docDicts)) {
if (CollectionUtil.isNotEmpty(docDicts)) {
dicMap.put("enums", docDicts);
Map<String, String> dicRequestJson = TornaConstants.buildParams(ENUM_PUSH, new Gson().toJson(dicMap), apiConfig);
String dicResponseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(dicRequestJson));
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public static void buildApiDoc(ApiConfig config, JavaProjectBuilder javaProjectB
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
RpcDocBuildTemplate docBuildTemplate = new RpcDocBuildTemplate();
List<RpcApiDoc> apiDocList = docBuildTemplate.getApiData(configBuilder);
buildTorna(apiDocList, config,javaProjectBuilder);
buildTorna(apiDocList, config, javaProjectBuilder);
}

public static void buildTorna(List<RpcApiDoc> apiDocs, ApiConfig apiConfig,JavaProjectBuilder builder) {
public static void buildTorna(List<RpcApiDoc> apiDocs, ApiConfig apiConfig, JavaProjectBuilder builder) {
TornaApi tornaApi = new TornaApi();
tornaApi.setAuthor(StringUtil.isEmpty(apiConfig.getAuthor()) ? System.getProperty("user.name") : apiConfig.getAuthor());
Apis api;
Expand Down Expand Up @@ -110,10 +110,10 @@ public static void buildTorna(List<RpcApiDoc> apiDocs, ApiConfig apiConfig,JavaP
Map<String, String> requestJson = TornaConstants.buildParams(PUSH, new Gson().toJson(tornaApi), apiConfig);

//推送字典信息
Map<String,Object> dicMap = new HashMap<>(2);
List<TornaDic> docDicts =TornaUtil.buildTornaDic(DocUtil.buildDictionary(apiConfig,builder));
Map<String, Object> dicMap = new HashMap<>(2);
List<TornaDic> docDicts = TornaUtil.buildTornaDic(DocUtil.buildDictionary(apiConfig, builder));

if(CollectionUtil.isNotEmpty(docDicts)) {
if (CollectionUtil.isNotEmpty(docDicts)) {
dicMap.put("enums", docDicts);
Map<String, String> dicRequestJson = TornaConstants.buildParams(ENUM_PUSH, new Gson().toJson(dicMap), apiConfig);
String dicResponseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(dicRequestJson));
Expand All @@ -123,6 +123,6 @@ public static void buildTorna(List<RpcApiDoc> apiDocs, ApiConfig apiConfig,JavaP
//获取返回结果
String responseMsg = OkHttp3Util.syncPostJson(apiConfig.getOpenUrl(), new Gson().toJson(requestJson));
//开启调试时打印请求信息
TornaUtil.printDebugInfo(apiConfig, responseMsg, requestJson,PUSH);
TornaUtil.printDebugInfo(apiConfig, responseMsg, requestJson, PUSH);
}
}

0 comments on commit 8850c08

Please sign in to comment.