Skip to content

Commit 0facdf7

Browse files
committed
Clean moved child
1 parent 59b1c26 commit 0facdf7

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ protected void ensureInheritanceForDiscriminatorMappings(Schema parent, String p
17451745
Schema child = ModelUtils.getSchema(openAPI, refSchemaName);
17461746
if (child != null) {
17471747
if (parentName != null) {
1748-
ensureInheritanceForDiscriminatorMappings(parent, child, parentName, new HashSet<>());
1748+
ensureInheritanceForDiscriminatorMapping(parent, child, parentName, new HashSet<>());
17491749
}
17501750
}
17511751
}
@@ -1755,7 +1755,7 @@ protected void ensureInheritanceForDiscriminatorMappings(Schema parent, String p
17551755
/**
17561756
* If not already present, add in the child an allOf referencing the parent.
17571757
*/
1758-
protected void ensureInheritanceForDiscriminatorMappings(Schema parent, Schema child, String parentName, Set<Schema> visitedSchemas) {
1758+
protected void ensureInheritanceForDiscriminatorMapping(Schema parent, Schema child, String parentName, Set<Schema> visitedSchemas) {
17591759
String reference = "#/components/schemas/" + parentName;
17601760
List<Schema> allOf = child.getAllOf();
17611761
if (allOf != null) {
@@ -1778,8 +1778,17 @@ protected void ensureInheritanceForDiscriminatorMappings(Schema parent, Schema c
17781778
.additionalProperties(child.getAdditionalProperties());
17791779
ModelUtils.copyMetadata(child, newChildProperties);
17801780
allOf.add(newChildProperties);
1781-
child.setProperties(null);
1782-
child.setType(null);
1781+
child.properties(null)
1782+
.type(null)
1783+
.additionalProperties(null)
1784+
.description(null)
1785+
._default(null)
1786+
.deprecated(null)
1787+
.example(null)
1788+
.examples(null)
1789+
.readOnly(null)
1790+
.writeOnly(null)
1791+
.title(null);
17831792
}
17841793
}
17851794
}

0 commit comments

Comments
 (0)