Skip to content

Commit

Permalink
Resolve wildcard bound in terminal type check (#1400)
Browse files Browse the repository at this point in the history
For quarkusio/quarkus#31744

Signed-off-by: Michael Edgar <michael@xlate.io>
  • Loading branch information
MikeEdgar authored Mar 14, 2023
1 parent bf63e1b commit 6aab1e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,11 @@ public static boolean isTerminalType(Type type) {
terminal = true;
break;
case TYPE_VARIABLE:
case WILDCARD_TYPE:
terminal = false;
break;
case WILDCARD_TYPE:
terminal = isTerminalType(resolveWildcard(type));
break;
case CLASS:
if (DOTNAME_OBJECT.equals(type.name())) {
terminal = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package io.smallrye.openapi.runtime.io.schema;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.util.Collections;
import java.util.concurrent.CompletableFuture;

import org.eclipse.microprofile.openapi.models.media.Schema;
import org.jboss.jandex.DotName;
import org.jboss.jandex.Index;
import org.jboss.jandex.ParameterizedType;
import org.jboss.jandex.Type;
import org.jboss.jandex.WildcardType;
import org.junit.jupiter.api.Test;

import io.smallrye.openapi.api.util.ClassLoaderUtil;
Expand All @@ -30,4 +33,13 @@ void testResolveAsyncType() {
assertEquals(STRING_TYPE, result);
}

@Test
void testWildcardSchemaIsEmpty() {
Index index = indexOf();
AnnotationScannerContext context = new AnnotationScannerContext(index, ClassLoaderUtil.getDefaultClassLoader(),
emptyConfig());
Type type = WildcardType.create(null, false);
Schema result = SchemaFactory.typeToSchema(context, type, null, Collections.emptyList());
assertNull(result.getType());
}
}

0 comments on commit 6aab1e5

Please sign in to comment.