File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
modules/swagger-codegen/src/main/java/io/swagger/codegen/v3 Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 4
4
import io .swagger .v3 .oas .models .media .Discriminator ;
5
5
6
6
import java .util .ArrayList ;
7
- import java .util .HashMap ;
8
7
import java .util .List ;
9
8
import java .util .Map ;
10
9
import java .util .Objects ;
@@ -518,11 +517,17 @@ public String getSubtypeName() {
518
517
if (getInterfaceModels ()!=null ) {
519
518
for (CodegenModel interfaceModel : getInterfaceModels ()) {
520
519
if (interfaceModel .getDiscriminator () != null && interfaceModel .getDiscriminator ().getMapping () != null ) {
521
- String name = interfaceModel .getDiscriminator ().getMapping ().get (classname );
522
- return name != null ? name : classname ;
520
+ String subTypeName = interfaceModel .getDiscriminator ().getMapping ().get (classname );
521
+ if (subTypeName !=null ) {
522
+ return subTypeName ;
523
+ }
523
524
}
524
525
}
525
526
}
526
- return classname ;
527
+ if (getParentModel ()!=null && getParentModel ().getDiscriminator ()!=null && getParentModel ().getDiscriminator ().getMapping ()!=null ) {
528
+ String subTypeName = getParentModel ().getDiscriminator ().getMapping ().get (classname );
529
+ return subTypeName !=null ?subTypeName :name ;
530
+ }
531
+ return name ;
527
532
}
528
533
}
You can’t perform that action at this time.
0 commit comments