Skip to content

Commit

Permalink
Merge pull request OpenAPITools#7 from Thecrazyskull/master
Browse files Browse the repository at this point in the history
AbstractKotlinCodegen: always prefer parent type regardless of whethe…
  • Loading branch information
Thecrazyskull authored Nov 18, 2020
2 parents 76f5580 + be3c215 commit 52e85d8
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,17 @@ private CodegenModel reconcileProperties(CodegenModel codegenModel,
Iterator<CodegenProperty> iterator = codegenProperties.iterator();
while (iterator.hasNext()) {
CodegenProperty codegenProperty = iterator.next();
if (codegenProperty.baseName.equals(parentModelCodegenProperty.baseName)
&& parentModelCodegenProperty.isEnum) {
if (codegenProperty.baseName.equals(parentModelCodegenProperty.baseName)) {
// If the current model is a discriminator type, while also being a parent
// the parent property should always be preferred.
// Remove the parent property from the inherited models.
if (codegenModel.discriminator != null) {
iterator.remove();
codegenModel.allVars.remove(codegenProperty);
codegenModel.parentVars.remove(codegenProperty);
continue;
}

// We found a property in the child class that is
// a duplicate of the one in the parent,
// so mark it as inherited & copy the data type.
Expand Down

0 comments on commit 52e85d8

Please # to comment.