3333import java .util .Iterator ;
3434import java .util .List ;
3535import java .util .Map ;
36+ import java .util .Map .Entry ;
3637import java .util .Optional ;
3738import java .util .Set ;
3839
40+ import com .fasterxml .jackson .annotation .JsonProperty ;
3941import com .fasterxml .jackson .databind .JavaType ;
40- import com .fasterxml .jackson .databind .ObjectMapper ;
41- import com .fasterxml .jackson .databind .introspect .SimpleMixInResolver ;
4242import io .swagger .v3 .core .converter .AnnotatedType ;
4343import io .swagger .v3 .core .converter .ModelConverter ;
4444import io .swagger .v3 .core .converter .ModelConverterContext ;
4545import io .swagger .v3 .core .converter .ModelConverterContextImpl ;
4646import io .swagger .v3 .core .util .AnnotationsUtils ;
47- import io .swagger .v3 .oas .annotations .media .SchemaProperty ;
4847import io .swagger .v3 .oas .models .media .Schema ;
4948import org .apache .commons .lang3 .StringUtils ;
5049import org .apache .commons .lang3 .reflect .FieldUtils ;
@@ -158,7 +157,7 @@ public void setJavadocDescription(Class<?> cls, List<Field> fields, List<Propert
158157 properties .entrySet ().stream ()
159158 .filter (stringSchemaEntry -> StringUtils .isBlank (stringSchemaEntry .getValue ().getDescription ()))
160159 .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 ();
162161 optionalField .ifPresent (field -> {
163162 String fieldJavadoc = javadocProvider .getFieldJavadoc (field );
164163 if (StringUtils .isNotBlank (fieldJavadoc ))
@@ -176,4 +175,27 @@ public void setJavadocDescription(Class<?> cls, List<Field> fields, List<Propert
176175 }
177176 }
178177 }
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+ }
179201}
0 commit comments