Skip to content

Commit

Permalink
Fix: @SchemaSwap with no target type (defaults to void) should cause …
Browse files Browse the repository at this point in the history
…the property to be skipped.
  • Loading branch information
xRodney committed Aug 30, 2022
1 parent 671e70d commit 7025175
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import static io.sundr.model.utils.Types.INT_REF;
import static io.sundr.model.utils.Types.LONG_REF;
import static io.sundr.model.utils.Types.STRING_REF;
import static io.sundr.model.utils.Types.VOID;

/**
* Encapsulates the common logic supporting OpenAPI schema generation for CRD generation.
Expand Down Expand Up @@ -169,7 +170,7 @@ private void extractSchemaSwap(ClassRef definitionType, Object annotation, Inter
schemaSwaps.registerSwap(definitionType,
extractClassRef(params.get("originalType")),
(String) params.get("fieldName"),
extractClassRef(params.get("targetType")));
extractClassRef(params.getOrDefault("targetType", void.class)));

} else {
throw new IllegalArgumentException("Unmanaged annotation type passed to the SchemaSwaps: " + annotation);
Expand Down Expand Up @@ -537,7 +538,7 @@ private T internalFromImpl(String name, TypeRef typeRef, Set<String> visited, In
.map(JsonNodeFactory.instance::textNode)
.toArray(JsonNode[]::new);
return enumProperty(enumValues);
} else {
} else if (!classRef.getFullyQualifiedName().equals(VOID.getName())) {
return resolveNestedClass(name, def, visited, schemaSwaps);
}

Expand Down

0 comments on commit 7025175

Please sign in to comment.