Skip to content

Commit

Permalink
Merge pull request #513 from shalousun/master
Browse files Browse the repository at this point in the history
fix ##509
  • Loading branch information
shalousun authored May 27, 2023
2 parents 9c36eaa + ff80d6a commit a86fbb7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## smart-doc版本

### 版本号:2.7.0

- 更新日期: 2023-06-0x
- 更新内容:
1. 支持在子类使用@JsonIgnore忽略后,同时忽略父类中的同名字段,[#509](https://github.com/smart-doc-group/smart-doc/issues/509)
2. 修复内部类嵌套结构formdata example错误。[pr#512](https://github.com/smart-doc-group/smart-doc/pull/512)

### 版本号:2.6.9

- 更新日期: 2023-05-14
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/com/power/doc/utils/JavaClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,6 @@ private static List<DocJavaField> getFields(JavaClass cls1, int counter, Map<Str
}
if (!cls1.isInterface()) {
for (JavaField javaField : cls1.getFields()) {
long count = javaField.getAnnotations().stream()
.filter(annotation -> DocAnnotationConstants.SHORT_JSON_IGNORE.equals(
annotation.getType().getSimpleName()))
.count();
if (count > 0) {
continue;
}
String fieldName = javaField.getName();
String subTypeName = javaField.getType().getFullyQualifiedName();

Expand All @@ -225,6 +218,15 @@ private static List<DocJavaField> getFields(JavaClass cls1, int counter, Map<Str
if (fieldName.startsWith("is") && ("boolean".equals(subTypeName))) {
fieldName = StringUtil.firstToLowerCase(fieldName.substring(2));
}
long count = javaField.getAnnotations().stream()
.filter(annotation -> DocAnnotationConstants.SHORT_JSON_IGNORE.equals(annotation.getType().getSimpleName()))
.count();
if (count > 0) {
if (addedFields.containsKey(fieldName)) {
addedFields.remove(fieldName);
}
continue;
}

DocJavaField docJavaField = DocJavaField.builder();
boolean typeChecked = false;
Expand Down

0 comments on commit a86fbb7

Please sign in to comment.