33
33
import java .util .Iterator ;
34
34
import java .util .List ;
35
35
import java .util .Map ;
36
+ import java .util .Map .Entry ;
36
37
import java .util .Optional ;
37
38
import java .util .Set ;
38
39
40
+ import com .fasterxml .jackson .annotation .JsonProperty ;
39
41
import com .fasterxml .jackson .databind .JavaType ;
40
- import com .fasterxml .jackson .databind .ObjectMapper ;
41
- import com .fasterxml .jackson .databind .introspect .SimpleMixInResolver ;
42
42
import io .swagger .v3 .core .converter .AnnotatedType ;
43
43
import io .swagger .v3 .core .converter .ModelConverter ;
44
44
import io .swagger .v3 .core .converter .ModelConverterContext ;
45
45
import io .swagger .v3 .core .converter .ModelConverterContextImpl ;
46
46
import io .swagger .v3 .core .util .AnnotationsUtils ;
47
- import io .swagger .v3 .oas .annotations .media .SchemaProperty ;
48
47
import io .swagger .v3 .oas .models .media .Schema ;
49
48
import org .apache .commons .lang3 .StringUtils ;
50
49
import org .apache .commons .lang3 .reflect .FieldUtils ;
@@ -158,7 +157,7 @@ public void setJavadocDescription(Class<?> cls, List<Field> fields, List<Propert
158
157
properties .entrySet ().stream ()
159
158
.filter (stringSchemaEntry -> StringUtils .isBlank (stringSchemaEntry .getValue ().getDescription ()))
160
159
.forEach (stringSchemaEntry -> {
161
- Optional <Field > optionalField = fields .stream ().filter (field1 -> field1 . getName (). equals ( stringSchemaEntry . getKey () )).findAny ();
160
+ Optional <Field > optionalField = fields .stream ().filter (field1 -> findFields ( stringSchemaEntry , field1 )).findAny ();
162
161
optionalField .ifPresent (field -> {
163
162
String fieldJavadoc = javadocProvider .getFieldJavadoc (field );
164
163
if (StringUtils .isNotBlank (fieldJavadoc ))
@@ -176,4 +175,27 @@ public void setJavadocDescription(Class<?> cls, List<Field> fields, List<Propert
176
175
}
177
176
}
178
177
}
178
+
179
+ /**
180
+ * Find fields boolean.
181
+ *
182
+ * @param stringSchemaEntry the string schema entry
183
+ * @param field the field
184
+ * @return the boolean
185
+ */
186
+ private static boolean findFields (Entry <String , Schema > stringSchemaEntry , Field field ) {
187
+ if (field .getName ().equals (stringSchemaEntry .getKey ())){
188
+ return true ;
189
+ }
190
+ else {
191
+ JsonProperty jsonPropertyAnnotation = field .getAnnotation (JsonProperty .class );
192
+ if (jsonPropertyAnnotation != null ) {
193
+ String jsonPropertyName = jsonPropertyAnnotation .value ();
194
+ if (jsonPropertyName .equals (stringSchemaEntry .getKey ())){
195
+ return true ;
196
+ }
197
+ }
198
+ return false ;
199
+ }
200
+ }
179
201
}
0 commit comments