Skip to content

Commit 18d2f81

Browse files
committed
Fix hasParent
1 parent 53c6f01 commit 18d2f81

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,9 @@ protected void ensureInheritanceForDiscriminatorMappings(Schema parent, Schema c
17671767
* return true if the child as an allOf referencing the parent scham.
17681768
*/
17691769
private boolean hasParent(Schema parent, Schema child, String reference, Set<Schema> visitedSchemas) {
1770+
if (child == null) {
1771+
return false;
1772+
}
17701773
if (child.get$ref() != null && child.get$ref().equals(reference)) {
17711774
return true;
17721775
}
@@ -1777,7 +1780,7 @@ private boolean hasParent(Schema parent, Schema child, String reference, Set<Sch
17771780
return false;
17781781
}
17791782
visitedSchemas.add(schema);
1780-
if (hasParent(schema, parent, reference, visitedSchemas)) {
1783+
if (hasParent(parent, schema, reference, visitedSchemas)) {
17811784
return true;
17821785
}
17831786
}

0 commit comments

Comments
 (0)