upgrade to 1.6

This commit is contained in:
oppofind 2019-11-13 11:34:34 +08:00
parent 122ef8b25d
commit 60870be61f
7 changed files with 35 additions and 14 deletions

View File

@ -29,13 +29,13 @@ which looks a html like generated by `asciidoctor-maven-plugin` plugin.
<dependency> <dependency>
<groupId>com.github.shalousun</groupId> <groupId>com.github.shalousun</groupId>
<artifactId>smart-doc</artifactId> <artifactId>smart-doc</artifactId>
<version>1.7.5</version> <version>1.7.6</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
``` ```
#### gradle #### gradle
``` ```
testCompile 'com.github.shalousun:smart-doc:1.7.5' testCompile 'com.github.shalousun:smart-doc:1.7.6'
``` ```
### Create a unit test ### Create a unit test
Just running a unit test will allow Smart-doc to generate a very concise api document for you, Just running a unit test will allow Smart-doc to generate a very concise api document for you,

View File

@ -30,13 +30,13 @@ smart-doc使用和测试可参考[smart-doc demo](https://gitee.com/sunyureposit
<dependency> <dependency>
<groupId>com.github.shalousun</groupId> <groupId>com.github.shalousun</groupId>
<artifactId>smart-doc</artifactId> <artifactId>smart-doc</artifactId>
<version>1.7.5</version> <version>1.7.6</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
``` ```
#### gradle #### gradle
``` ```
testCompile 'com.github.shalousun:smart-doc:1.7.5' testCompile 'com.github.shalousun:smart-doc:1.7.6'
``` ```
### Create a unit test ### Create a unit test
通过运行一个单元测试来让Smart-doc为你生成一个简洁明了的api文档 通过运行一个单元测试来让Smart-doc为你生成一个简洁明了的api文档

View File

@ -113,6 +113,12 @@
6. 修改方法注释相同引起的html链接跳转错误。 6. 修改方法注释相同引起的html链接跳转错误。
7. 添加生成AllInOne的覆盖配置项默认自动加版本号不覆盖。 7. 添加生成AllInOne的覆盖配置项默认自动加版本号不覆盖。
8. 新增枚举字典码导出到文档的功能。 8. 新增枚举字典码导出到文档的功能。
#### 版本号1.7.6
- 更新日期2019-11-13
- 更新内容:
1. fix #I14PT5 header重复渲染到文档
2. fix #I14MV7 不设置dataDictionaries出现空指针错误
3. 增加请求参数枚举字段解析(试用功能)

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>smart-doc</artifactId> <artifactId>smart-doc</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.7.5</version> <version>1.7.6</version>
<name>smart-doc</name> <name>smart-doc</name>
<url>https://github.com/shalousun/smart-doc.git</url> <url>https://github.com/shalousun/smart-doc.git</url>

View File

@ -280,22 +280,18 @@ public class SourceBuilder {
apiMethodDoc.setResponseUsage(buildReturnJson(method, this.fieldMap)); apiMethodDoc.setResponseUsage(buildReturnJson(method, this.fieldMap));
List<ApiParam> responseParams = buildReturnApiParams(method, cls.getGenericFullyQualifiedName()); List<ApiParam> responseParams = buildReturnApiParams(method, cls.getGenericFullyQualifiedName());
apiMethodDoc.setResponseParams(responseParams); apiMethodDoc.setResponseParams(responseParams);
//reduce create in template
apiMethodDoc.setHeaders(createHeaders(this.headers, this.isAdoc));
List<ApiReqHeader> allApiReqHeaders; List<ApiReqHeader> allApiReqHeaders;
if (this.headers != null) { if (this.headers != null) {
allApiReqHeaders = Stream.of(this.headers, apiReqHeaders) allApiReqHeaders = Stream.of(this.headers, apiReqHeaders)
.flatMap(Collection::stream) .flatMap(Collection::stream)
.collect(Collectors.collectingAndThen( .distinct()
Collectors.toCollection( .collect(Collectors.toList());
()->new TreeSet<>(Comparator.comparing(ApiReqHeader::getName))
)
,ArrayList::new));
} else { } else {
allApiReqHeaders = apiReqHeaders; allApiReqHeaders = apiReqHeaders;
} }
//reduce create in template
apiMethodDoc.setHeaders(createHeaders(allApiReqHeaders, this.isAdoc));
apiMethodDoc.setRequestHeaders(allApiReqHeaders); apiMethodDoc.setRequestHeaders(allApiReqHeaders);
methodDocList.add(apiMethodDoc); methodDocList.add(apiMethodDoc);

View File

@ -4,6 +4,7 @@ import com.power.common.util.CollectionUtil;
import com.power.doc.constants.DocLanguage; import com.power.doc.constants.DocLanguage;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* Description: * Description:
@ -133,6 +134,8 @@ public class ApiConfig {
public void setRequestHeaders(ApiReqHeader... requestHeaders) { public void setRequestHeaders(ApiReqHeader... requestHeaders) {
this.requestHeaders = CollectionUtil.asList(requestHeaders); this.requestHeaders = CollectionUtil.asList(requestHeaders);
this.requestHeaders.stream().map(header -> header.setDesc(header.getDesc()+"(Global)"))
.collect(Collectors.toList());
} }
public List<CustomRespField> getCustomResponseFields() { public List<CustomRespField> getCustomResponseFields() {

View File

@ -1,5 +1,7 @@
package com.power.doc.model; package com.power.doc.model;
import java.util.Objects;
/** /**
* Description: * Description:
* http request header info model * http request header info model
@ -84,4 +86,18 @@ public class ApiReqHeader {
this.since = since; this.since = since;
return this; return this;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ApiReqHeader that = (ApiReqHeader) o;
return Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
} }