Optimized group verification support

This commit is contained in:
oppofind 2020-03-29 22:50:23 +08:00
parent c56237847e
commit 332b9f0ac6
4 changed files with 23 additions and 6 deletions

View File

@ -5,7 +5,7 @@
- 更新内容:
1. Controller新增时候@ignore tag,可适应该tag忽略不需要生成文档的controller[git #24](https://github.com/smart-doc-group/smart-doc/issues/24)。
2. 参数中包含 HttpSession时smart-doc卡主[gitee #I1CA9M](https://gitee.com/sunyurepository/smart-doc/issues/I1CA9M)
3. 增加对代码中@author tag的支持支持多作者
3. 解决一些复杂分组场景smart-doc报错的问题[gitee #I1CPSM](https://gitee.com/sunyurepository/smart-doc/issues/I1CPSM)
#### 版本号1.8.3
- 更新日期: 2020-03-21
- 更新内容:

View File

@ -180,6 +180,7 @@ Thanks to the following people who have submitted major pull requests:
- [@su-qiu](https://github.com/su-qiu)
- [@qinkangdeid](https://github.com/qinkangdeid)
- [@br7roy](https://github.com/br7roy)
- [@caiqyxyx](https://gitee.com/cy-work)
## Other reference
- [Smart-doc manual](https://github.com/shalousun/smart-doc/wiki)

View File

@ -9,7 +9,7 @@ smart-doc完全基于接口源码分析来生成接口文档完全做到零
- 基于源代码接口定义自动推导,强大的返回结构推导。
- 支持Spring MVC,Spring Boot,Spring Boot Web Flux(controller书写方式)。
- 支持Callable,Future,CompletableFuture等异步接口返回的推导。
- 支持JavaBean上的JSR303参数校验规范。
- 支持JavaBean上的JSR303参数校验规范,包括分组验证
- 对json请求参数的接口能够自动生成模拟json参数。
- 对一些常用字段定义能够生成有效的模拟值。
- 支持生成json返回值示例。
@ -18,6 +18,7 @@ smart-doc完全基于接口源码分析来生成接口文档完全做到零
- 轻易实现在Spring Boot服务上在线查看静态HTML5 api文档。
- 开放文档数据,可自由实现接入文档管理系统。
- 支持导出错误码和定义在代码中的各种字典码到接口文档。
- 支持插件式轻松集成。
## Getting started
smart-doc使用和测试可参考[smart-doc demo](https://gitee.com/sunyurepository/api-doc-test.git)。
```
@ -163,6 +164,7 @@ mvn clean install -Dmaven.test.skip=true
- [@su-qiu](https://github.com/su-qiu)
- [@qinkangdeid](https://github.com/qinkangdeid)
- [@br7roy](https://github.com/br7roy)
- [@caiqyxyx](https://gitee.com/cy-work)
## Other reference
- [smart-doc功能使用介绍](https://my.oschina.net/u/1760791/blog/2250962)
- [smart-doc官方wiki](https://gitee.com/sunyurepository/smart-doc/wikis/Home?sort_id=1652800)

View File

@ -223,8 +223,8 @@ public class JavaClassUtil {
/**
* 通过name获取类标签的value
*
* @param cls
* @param tagName 需要获取的标签name
* @param cls
* @param tagName 需要获取的标签name
* @param checkComments 检查注释
* @return 类标签的value
* @author songhaozhi
@ -267,11 +267,25 @@ public class JavaClassUtil {
String simpleName = javaAnnotation.getType().getValue();
if (simpleName.equalsIgnoreCase(ValidatorAnnotations.VALIDATED)) {
if (Objects.nonNull(javaAnnotation.getProperty(DocAnnotationConstants.VALUE_PROP))) {
annotationValueList = ((AnnotationValueList) javaAnnotation.getProperty(DocAnnotationConstants.VALUE_PROP)).getValueList();
AnnotationValue v = javaAnnotation.getProperty(DocAnnotationConstants.VALUE_PROP);
if (v instanceof AnnotationValueList) {
annotationValueList = ((AnnotationValueList) v).getValueList();
}
if (v instanceof TypeRef) {
annotationValueList = new ArrayList<>();
annotationValueList.add(v);
}
}
} else if (validates.contains(simpleName)) {
if (Objects.nonNull(javaAnnotation.getProperty(DocAnnotationConstants.GROUP_PROP))) {
annotationValueList = ((AnnotationValueList) javaAnnotation.getProperty(DocAnnotationConstants.GROUP_PROP)).getValueList();
AnnotationValue v = javaAnnotation.getProperty(DocAnnotationConstants.GROUP_PROP);
if (v instanceof AnnotationValueList) {
annotationValueList = ((AnnotationValueList) v).getValueList();
}
if (v instanceof TypeRef) {
annotationValueList = new ArrayList<>();
annotationValueList.add(v);
}
}
}
return annotationValueList;