Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve wildcard bound in terminal type check #1400

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}