Skip to content

Commit

Permalink
fix gitee #I3BTFY . Analyze the LocalDateTime type field error in the…
Browse files Browse the repository at this point in the history
… parent class
  • Loading branch information
shalousun committed May 29, 2021
1 parent 37bcd3f commit d837bfd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
1. 修复inlineEnum为false时枚举展示在参数中的问题。
2. 返回Spring文件下载对象支持自动识别为文件下载,减少手动标记@download tag。
3. smart-doc使用的css cdn更换,默认使用国内cdn,提升国内的加载速度,切换英文环境使用google的cdn.
4. 多层泛型嵌套的解析支持。gitee #I3T6UV .
4. 添加多层泛型嵌套的解析支持。gitee #I3T6UV .
5. 修复父类是泛型时父类中LocalDateTime类型字段生成json样例错误。
6. 添加将接口排序order推送到torna中。
#### 版本号:2.1.8

- 更新日期: 2020-05-22
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/com/power/doc/helper/JsonBuildHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,11 @@ public static String buildJson(String typeName, String genericCanonicalName,
out:
for (DocJavaField docField : fields) {
JavaField field = docField.getJavaField();
String subTypeName = docField.getFullyQualifiedName();
String fieldName = field.getName();
if (field.isStatic() || "this$0".equals(fieldName) ||
JavaClassValidateUtil.isIgnoreFieldTypes(subTypeName)) {
continue;
}
if (field.isTransient() && skipTransientField) {
continue;
}
String subTypeName = docField.getFullyQualifiedName();
String fieldName = field.getName();
if ((responseFieldToUnderline && isResp) || (requestFieldToUnderline && !isResp)) {
fieldName = StringUtil.camelToUnderline(fieldName);
}
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/com/power/doc/helper/ParamsBuildHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,11 @@ public static List<ApiParam> buildParams(String className, String pre, int level
out:
for (DocJavaField docField : fields) {
JavaField field = docField.getJavaField();
String fieldName = field.getName();
String subTypeName = docField.getFullyQualifiedName();
if (field.isStatic() || "this$0".equals(fieldName) ||
JavaClassValidateUtil.isIgnoreFieldTypes(subTypeName)) {
continue;
}
if (field.isTransient() && skipTransientField) {
continue;
}

String fieldName = field.getName();
String subTypeName = docField.getFullyQualifiedName();
if ((responseFieldToUnderline && isResp) || (requestFieldToUnderline && !isResp)) {
fieldName = StringUtil.camelToUnderline(fieldName);
}
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/power/doc/utils/JavaClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,15 @@ public static List<DocJavaField> getFields(JavaClass cls1, int counter, Map<Stri
}
for (JavaField javaField : cls1.getFields()) {
String fieldName = javaField.getName();
String subTypeName = javaField.getType().getFullyQualifiedName();
if (javaField.isStatic() || "this$0".equals(fieldName) ||
JavaClassValidateUtil.isIgnoreFieldTypes(subTypeName)) {
continue;
}
DocJavaField docJavaField = DocJavaField.builder();
boolean typeChecked = false;
String gicName = javaField.getType().getGenericCanonicalName();
String subTypeName = javaField.getType().getFullyQualifiedName();

String actualType = null;
if (JavaClassValidateUtil.isCollection(subTypeName) &&
!JavaClassValidateUtil.isCollection(gicName)) {
Expand All @@ -160,7 +165,7 @@ public static List<DocJavaField> getFields(JavaClass cls1, int counter, Map<Stri
for (Map.Entry<String, JavaType> entry : actualJavaTypes.entrySet()) {
String key = entry.getKey();
JavaType value = entry.getValue();
if (gicName.contains(key)) {
if (gicName.equals(key)) {
subTypeName = subTypeName.replaceAll(key, value.getFullyQualifiedName());
gicName = gicName.replaceAll(key, value.getGenericCanonicalName());
actualType = value.getFullyQualifiedName();
Expand Down

0 comments on commit d837bfd

Please sign in to comment.