File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
modules/swagger-codegen/src/main/java/io/swagger/codegen/v3 Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -509,4 +509,20 @@ public boolean getIsComposedModel() {
509
509
public void setIsComposedModel (boolean isComposedModel ) {
510
510
this .isComposedModel = isComposedModel ;
511
511
}
512
+
513
+ /**
514
+ * Get the subtype name from the interface model
515
+ * @return name : the name assigned to the class by the discriminator mapping or classname if mapping not found
516
+ */
517
+ public String getSubtypeName () {
518
+ if (getInterfaceModels ()!=null ) {
519
+ for (CodegenModel interfaceModel : getInterfaceModels ()) {
520
+ if (interfaceModel .getDiscriminator () != null && interfaceModel .getDiscriminator ().getMapping () != null ) {
521
+ String name = interfaceModel .getDiscriminator ().getMapping ().get (classname );
522
+ return name != null ? name : classname ;
523
+ }
524
+ }
525
+ }
526
+ return classname ;
527
+ }
512
528
}
You can’t perform that action at this time.
0 commit comments