This commit is contained in:
chenqi 2021-08-07 18:15:32 +08:00
commit 1330e887c8
7 changed files with 43 additions and 3 deletions

View File

@ -1,5 +1,15 @@
## smart-doc版本
#### 版本号2.2.4
- 更新日期: 2021-08-04
- 更新内容:
1. 修复字典码推送torna错误 #https://gitee.com/smart-doc-team/smart-doc/issues/I43JQR。
2. 新增jsr303 @size和@length支持
3. 修改html的模板样式错误。
4. 修复postman错误#I41G2E 。
5. 新增isReplace配置 。
6. 修复当存在多个jsr注解时部分注解失效问题。
#### 版本号2.2.3
- 更新日期: 2021-07-18

View File

@ -140,6 +140,7 @@ When you need to use smart-doc to generate more API document information, you ca
"appKey": "xxx",// torna appKey, @since 2.0.9
"appToken": "xxx", //torna appToken,@since 2.0.9
"secret": "xx",//torna secret@since 2.0.9
"isReplace":true, torna replace doc @since 2.2.4
"openUrl": "torna server/api/",//torna server url,@since 2.0.9
"tornaDebug":false,"// show log while set true
"ignoreRequestParams":[ //The request parameter object will be discarded when generating the document.@since 1.9.2

View File

@ -83,6 +83,7 @@ smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc
<!--smart-doc能自动分析依赖树加载所有依赖源码原则上会影响文档构建效率因此你可以使用includes来让插件加载你配置的组件-->
<includes>
<!--格式为groupId:artifactId;参考如下-->
<!--也可以支持正则式如com.alibaba:.* -->
<include>com.alibaba:fastjson</include>
</includes>
</configuration>

View File

@ -72,6 +72,10 @@ public interface DocAnnotationConstants {
String MAX = "max";
String SIZE = "size";
String LENGTH = "length";
String JSON_PROPERTY = "JsonProperty";
/**

View File

@ -101,7 +101,7 @@ public class ParamsBuildHelper {
registryClasses, projectBuilder, groupClasses, pid, jsonRequest));
}
} else if (DocGlobalConstants.JAVA_OBJECT_FULLY.equals(className)) {
ApiParam param = ApiParam.of().setField(pre + "any object").setType("object").setPid(pid);
ApiParam param = ApiParam.of().setId(pid + 1).setField(pre + "any object").setType("object").setPid(pid);
if (StringUtil.isEmpty(isRequired)) {
param.setDesc(DocGlobalConstants.ANY_OBJECT_MSG).setVersion(DocGlobalConstants.DEFAULT_VERSION);
} else {
@ -163,9 +163,20 @@ public class ParamsBuildHelper {
an:
for (JavaAnnotation annotation : javaAnnotations) {
String simpleAnnotationName = annotation.getType().getValue();
AnnotationValue annotationValue = null;
if (DocAnnotationConstants.MAX.equalsIgnoreCase(simpleAnnotationName)) {
maxLength = annotation.getProperty(DocAnnotationConstants.VALUE_PROP).toString();
annotationValue = annotation.getProperty(DocAnnotationConstants.VALUE_PROP);
}
if (DocAnnotationConstants.SIZE.equalsIgnoreCase(simpleAnnotationName)) {
annotationValue = annotation.getProperty(DocAnnotationConstants.MAX);
}
if (DocAnnotationConstants.LENGTH.equalsIgnoreCase(simpleAnnotationName)) {
annotationValue = annotation.getProperty(DocAnnotationConstants.MAX);
}
if (!Objects.isNull(annotationValue)) {
maxLength = annotationValue.toString();
}
if (DocAnnotationConstants.JSON_PROPERTY.equalsIgnoreCase(simpleAnnotationName)) {
AnnotationValue value = annotation.getProperty("access");
if (Objects.nonNull(value)) {

View File

@ -42,6 +42,18 @@ public class TornaApi {
List<Apis> apis;
String author;
List<CommonErrorCode> commonErrorCodes;
/**
* 是否替换文档1替换0不替换追加缺省1
*/
Integer isReplace;
public Integer getIsReplace() {
return isReplace;
}
public void setIsReplace(Integer isReplace) {
this.isReplace = isReplace;
}
public String getAuthor() {
return author;

View File

@ -240,9 +240,10 @@ public class TornaUtil {
public static List<TornaDic> buildTornaDic(List<ApiDocDict> apiDocDicts) {
List<TornaDic> dics = new ArrayList<>();
TornaDic tornaDic = new TornaDic();
TornaDic tornaDic ;
if (CollectionUtil.isNotEmpty(apiDocDicts)) {
for (ApiDocDict doc : apiDocDicts) {
tornaDic = new TornaDic();
tornaDic.setName(doc.getTitle())
// .setDescription(doc.getTitle())
.setItems(buildTornaDicItems(doc.getDataDictList()));