diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java index 6df1068cc92..736788bfdbe 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java @@ -116,7 +116,6 @@ protected T internalFrom(TypeDef definition, String... ignore) { } private T internalFromImpl(TypeDef definition, Set visited, String... ignore) { - visited.add(definition.getFullyQualifiedName()); final B builder = newBuilder(); Set ignores = ignore.length > 0 ? new LinkedHashSet<>(Arrays.asList(ignore)) : Collections @@ -420,6 +419,7 @@ private T internalFromImpl(String name, TypeRef typeRef, Set visited) { if (!def.getFullyQualifiedName().startsWith("java") && visited.contains(def.getFullyQualifiedName())) { throw new IllegalArgumentException("Found a cyclic reference involving " + def.getFullyQualifiedName()); } + visited.add(def.getFullyQualifiedName()); return internalFromImpl(def, visited); }