31
31
import java .util .ArrayList ;
32
32
import java .util .Collection ;
33
33
import java .util .Collections ;
34
+ import java .util .HashSet ;
34
35
import java .util .Iterator ;
35
36
import java .util .List ;
37
+ import java .util .Set ;
36
38
37
39
import com .fasterxml .jackson .annotation .JsonUnwrapped ;
38
40
import com .fasterxml .jackson .databind .JavaType ;
39
41
import io .swagger .v3 .core .converter .AnnotatedType ;
40
42
import io .swagger .v3 .core .converter .ModelConverter ;
41
43
import io .swagger .v3 .core .converter .ModelConverterContext ;
44
+ import io .swagger .v3 .core .jackson .TypeNameResolver ;
42
45
import io .swagger .v3 .core .util .AnnotationsUtils ;
43
46
import io .swagger .v3 .oas .models .Components ;
44
47
import io .swagger .v3 .oas .models .media .ComposedSchema ;
@@ -63,12 +66,12 @@ public class PolymorphicModelConverter implements ModelConverter {
63
66
/**
64
67
* The constant PARENT_TYPES_TO_IGNORE.
65
68
*/
66
- private static final List <String > PARENT_TYPES_TO_IGNORE = Collections .synchronizedList (new ArrayList <>());
69
+ private static final Set <String > PARENT_TYPES_TO_IGNORE = Collections .synchronizedSet (new HashSet <>());
67
70
68
71
/**
69
72
* The constant PARENT_TYPES_TO_IGNORE.
70
73
*/
71
- private static final List <String > TYPES_TO_SKIP = Collections .synchronizedList (new ArrayList <>());
74
+ private static final Set <String > TYPES_TO_SKIP = Collections .synchronizedSet (new HashSet <>());
72
75
73
76
static {
74
77
PARENT_TYPES_TO_IGNORE .add ("JsonSchema" );
@@ -119,7 +122,10 @@ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterato
119
122
if (javaType != null ) {
120
123
for (Field field : FieldUtils .getAllFields (javaType .getRawClass ())) {
121
124
if (field .isAnnotationPresent (JsonUnwrapped .class )) {
122
- PARENT_TYPES_TO_IGNORE .add (javaType .getRawClass ().getSimpleName ());
125
+ if (!TypeNameResolver .std .getUseFqn ())
126
+ PARENT_TYPES_TO_IGNORE .add (javaType .getRawClass ().getSimpleName ());
127
+ else
128
+ PARENT_TYPES_TO_IGNORE .add (javaType .getRawClass ().getName ());
123
129
}
124
130
else if (field .isAnnotationPresent (io .swagger .v3 .oas .annotations .media .Schema .class )) {
125
131
io .swagger .v3 .oas .annotations .media .Schema declaredSchema = field .getDeclaredAnnotation (io .swagger .v3 .oas .annotations .media .Schema .class );
0 commit comments