diff --git a/core/pom.xml b/core/pom.xml
index 36fcd0670..1c9d3b086 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -85,6 +85,7 @@
io.smallrye
smallrye-open-api-testsuite-data
+ indexed
test
diff --git a/core/src/main/java/io/smallrye/openapi/runtime/util/TypeUtil.java b/core/src/main/java/io/smallrye/openapi/runtime/util/TypeUtil.java
index c00c57189..4d516c47b 100644
--- a/core/src/main/java/io/smallrye/openapi/runtime/util/TypeUtil.java
+++ b/core/src/main/java/io/smallrye/openapi/runtime/util/TypeUtil.java
@@ -418,7 +418,7 @@ private static boolean isAssignableFrom(DotName subject, DotName object, ClassLo
Class> subjectKlazz = TypeUtil.getClass(subject, cl);
Class> objectKlazz = TypeUtil.getClass(object, cl);
return objectKlazz.isAssignableFrom(subjectKlazz);
- } catch (@SuppressWarnings("unused") ClassNotFoundException nfe) {
+ } catch (@SuppressWarnings("unused") ClassNotFoundException | NoClassDefFoundError nfe) {
return false;
}
}
diff --git a/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java b/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java
index 52142c86d..c5933f707 100644
--- a/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java
+++ b/core/src/test/java/io/smallrye/openapi/runtime/scanner/IndexScannerTestBase.java
@@ -175,7 +175,11 @@ public static void assertJsonEquals(String entityName, String expectedResource,
public static void assertJsonEquals(String expectedResource, OpenAPI actual) throws JSONException, IOException {
URL resourceUrl = IndexScannerTestBase.class.getResource(expectedResource);
- JSONAssert.assertEquals(loadResource(resourceUrl), OpenApiSerializer.serialize(actual, Format.JSON),
+ assertJsonEquals(resourceUrl, actual);
+ }
+
+ public static void assertJsonEquals(URL expectedResourceUrl, OpenAPI actual) throws JSONException, IOException {
+ JSONAssert.assertEquals(loadResource(expectedResourceUrl), OpenApiSerializer.serialize(actual, Format.JSON),
true);
}
diff --git a/extension-jaxrs/pom.xml b/extension-jaxrs/pom.xml
index 161ba6b55..8c2872427 100644
--- a/extension-jaxrs/pom.xml
+++ b/extension-jaxrs/pom.xml
@@ -81,7 +81,7 @@
test
-
+
${project.groupId}
smallrye-open-api-core
@@ -89,6 +89,12 @@
test-jar
test
+
+ io.smallrye
+ smallrye-open-api-testsuite-data
+ indexed
+ test
+
diff --git a/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/JaxRsAnnotationScannerTest.java b/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/JaxRsAnnotationScannerTest.java
index 7e352e20b..249e54d62 100644
--- a/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/JaxRsAnnotationScannerTest.java
+++ b/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/JaxRsAnnotationScannerTest.java
@@ -6,7 +6,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.UUID;
-import java.util.zip.GZIPInputStream;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
@@ -467,11 +466,12 @@ void testCsvProducesConsumesJakarta() throws IOException, JSONException {
/* *************************************************************************/
@Test
void testSyntheticClassesAndInterfacesIgnoredByDefault() throws IOException, JSONException {
- String indexPath = "/io/smallrye/openapi/runtime/jandex-panache+reactive-client.idx.gz";
- try (InputStream source = new GZIPInputStream(getClass().getResourceAsStream(indexPath))) {
+ try (InputStream source = getClass().getResourceAsStream("/smallrye-open-api-testsuite-data.idx")) {
IndexReader reader = new IndexReader(source);
- Index i = reader.read();
- OpenAPI result = OpenApiProcessor.bootstrap(emptyConfig(), i);
+ Index index = reader.read();
+ OpenAPI result = OpenApiProcessor.bootstrap(
+ dynamicConfig(OASConfig.SCAN_EXCLUDE_PACKAGES, "io.smallrye.openapi.testdata.kotlin"),
+ index);
printToConsole(result);
assertJsonEquals("ignore.synthetic-classes-interfaces.json", result);
}
diff --git a/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/jandex-panache+reactive-client.idx.gz b/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/jandex-panache+reactive-client.idx.gz
deleted file mode 100644
index b66a18231..000000000
Binary files a/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/jandex-panache+reactive-client.idx.gz and /dev/null differ
diff --git a/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/ignore.synthetic-classes-interfaces.json b/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/ignore.synthetic-classes-interfaces.json
index cb093c57e..1dad3204b 100644
--- a/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/ignore.synthetic-classes-interfaces.json
+++ b/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/ignore.synthetic-classes-interfaces.json
@@ -4,10 +4,40 @@
"title": "Generated API",
"version": "1.0"
},
+ "tags": [
+ {
+ "name": "PeopleResource"
+ }
+ ],
"paths": {
"/people": {
"get": {
+ "tags": [
+ "PeopleResource"
+ ],
"parameters": [
+ {
+ "name": "id",
+ "in": "query",
+ "schema": {
+ "format": "int64",
+ "type": "integer"
+ }
+ },
+ {
+ "name": "name",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "namedQuery",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
{
"name": "page",
"in": "query",
@@ -32,18 +62,31 @@
"schema": {
"type": "array",
"items": {
-
+
}
}
}
],
"responses": {
"200": {
- "description": "OK"
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Person"
+ }
+ }
+ }
+ }
}
}
},
"post": {
+ "tags": [
+ "PeopleResource"
+ ],
"requestBody": {
"content": {
"application/json": {
@@ -53,15 +96,44 @@
}
}
},
+ "responses": {
+ "201": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Person"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/people/count": {
+ "get": {
+ "tags": [
+ "PeopleResource"
+ ],
"responses": {
"200": {
- "description": "OK"
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "format": "int64",
+ "type": "integer"
+ }
+ }
+ }
}
}
}
},
"/people/{id}": {
"get": {
+ "tags": [
+ "PeopleResource"
+ ],
"parameters": [
{
"name": "id",
@@ -75,11 +147,21 @@
],
"responses": {
"200": {
- "description": "OK"
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Person"
+ }
+ }
+ }
}
}
},
"put": {
+ "tags": [
+ "PeopleResource"
+ ],
"parameters": [
{
"name": "id",
@@ -101,12 +183,21 @@
}
},
"responses": {
- "200": {
- "description": "OK"
+ "201": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Person"
+ }
+ }
+ }
}
}
},
"delete": {
+ "tags": [
+ "PeopleResource"
+ ],
"parameters": [
{
"name": "id",
@@ -119,8 +210,8 @@
}
],
"responses": {
- "200": {
- "description": "OK"
+ "204": {
+
}
}
}
diff --git a/pom.xml b/pom.xml
index 2d53c3507..5d2007cb4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,9 @@
6.2.3.Final
5.1.0.Final
+
+
+ testsuite/data/**/*.java
@@ -240,7 +243,14 @@
${project.groupId}
smallrye-open-api-testsuite-data
+ indexed
${project.version}
+
+
+ *
+ *
+
+
diff --git a/testsuite/data/pom.xml b/testsuite/data/pom.xml
index 1164c68e9..b11d23726 100644
--- a/testsuite/data/pom.xml
+++ b/testsuite/data/pom.xml
@@ -1,28 +1,75 @@
4.0.0
+
io.smallrye
- smallrye-open-api-testsuite
- 3.3.1-SNAPSHOT
+ smallrye-build-parent
+ 39
smallrye-open-api-testsuite-data
+ 3.3.1-SNAPSHOT
SmallRye: OpenAPI Test Data
1.7.20
11
+ quarkus-bom
+ io.quarkus
+ 2.16.4.Final
+ uber-jar
+ false
+
+
+
+ ${quarkus.platform.group-id}
+ ${quarkus.platform.artifact-id}
+ ${quarkus.platform.version}
+ pom
+ import
+
+
+
+
org.eclipse.microprofile.openapi
microprofile-openapi-api
+
+ jakarta.enterprise
+ jakarta.enterprise.cdi-api
+ compile
+
+
+ io.quarkus
+ quarkus-rest-client-reactive
+
+
+ io.quarkus
+ quarkus-resteasy-reactive-jackson
+
+
+ io.quarkus
+ quarkus-rest-client-reactive-jackson
+
+
+ io.quarkus
+ quarkus-hibernate-orm-rest-data-panache
+
+
+ io.quarkus
+ quarkus-smallrye-openapi
+
+
+ io.quarkus
+ quarkus-jdbc-postgresql
+
org.jetbrains.kotlin
kotlin-stdlib
- ${kotlin.version}
@@ -31,6 +78,7 @@
org.codehaus.mojo
build-helper-maven-plugin
+ 3.3.0
add-source
@@ -46,9 +94,7 @@
-
+
org.jetbrains.kotlin
kotlin-maven-plugin
@@ -98,6 +144,58 @@
+
+ io.quarkus
+ quarkus-maven-plugin
+ ${quarkus.platform.version}
+ true
+
+
+
+ build
+ generate-code
+ generate-code-tests
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 3.3.0
+
+
+ indexed-assembly
+ package
+
+ single
+
+
+
+ src/assembly/indexed.xml
+
+
+
+
+
+
+ io.smallrye
+ jandex-maven-plugin
+ 3.0.5
+
+ ${project.build.directory}/smallrye-open-api-testsuite-data-${project.version}-indexed.jar
+ ${project.artifactId}.idx
+
+
+
+ make-index
+
+ jandex-jar
+
+ package
+
+
+
org.apache.maven.plugins
maven-install-plugin
diff --git a/testsuite/data/src/assembly/indexed.xml b/testsuite/data/src/assembly/indexed.xml
new file mode 100644
index 000000000..3b7bf1e58
--- /dev/null
+++ b/testsuite/data/src/assembly/indexed.xml
@@ -0,0 +1,27 @@
+
+
+ indexed
+
+
+ jar
+
+
+ false
+
+
+
+ /
+ true
+ true
+
+
+ io/smallrye/openapi/testdata/**/*
+
+
+ runtime
+
+
+
diff --git a/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/InvisibleHttpClient.java b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/InvisibleHttpClient.java
new file mode 100644
index 000000000..251b6edc6
--- /dev/null
+++ b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/InvisibleHttpClient.java
@@ -0,0 +1,14 @@
+package io.smallrye.openapi.testdata.java.panache.reactiveclient;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
+
+@RegisterRestClient
+public interface InvisibleHttpClient {
+
+ @GET
+ @Path("/get")
+ String get();
+}
diff --git a/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/PeopleResource.java b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/PeopleResource.java
new file mode 100644
index 000000000..a4056e45d
--- /dev/null
+++ b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/PeopleResource.java
@@ -0,0 +1,7 @@
+package io.smallrye.openapi.testdata.java.panache.reactiveclient;
+
+import io.quarkus.hibernate.orm.rest.data.panache.PanacheEntityResource;
+
+public interface PeopleResource extends PanacheEntityResource {
+
+}
diff --git a/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/Person.java b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/Person.java
new file mode 100644
index 000000000..18eacf2fe
--- /dev/null
+++ b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/Person.java
@@ -0,0 +1,10 @@
+package io.smallrye.openapi.testdata.java.panache.reactiveclient;
+
+import javax.persistence.Entity;
+
+import io.quarkus.hibernate.orm.panache.PanacheEntity;
+
+@Entity(name = "PersonForEntity")
+public class Person extends PanacheEntity {
+ String name;
+}
diff --git a/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/Product.java b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/Product.java
new file mode 100644
index 000000000..9de1079a7
--- /dev/null
+++ b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/Product.java
@@ -0,0 +1,14 @@
+package io.smallrye.openapi.testdata.java.panache.reactiveclient;
+
+public class Product {
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/ProductResource.java b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/ProductResource.java
new file mode 100644
index 000000000..b885d4ac2
--- /dev/null
+++ b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/ProductResource.java
@@ -0,0 +1,18 @@
+package io.smallrye.openapi.testdata.java.panache.reactiveclient;
+
+import javax.enterprise.context.RequestScoped;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/product")
+@RequestScoped
+public class ProductResource {
+
+ @GET
+ public Product get() {
+ var product = new Product();
+ product.setName("Quarkus T-Shirt");
+
+ return product;
+ }
+}
diff --git a/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/VisibleHttpClient.java b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/VisibleHttpClient.java
new file mode 100644
index 000000000..3b9c3d598
--- /dev/null
+++ b/testsuite/data/src/main/java/io/smallrye/openapi/testdata/java/panache/reactiveclient/VisibleHttpClient.java
@@ -0,0 +1,14 @@
+package io.smallrye.openapi.testdata.java.panache.reactiveclient;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
+
+@RegisterRestClient
+@Path("/get")
+public interface VisibleHttpClient {
+
+ @GET
+ String get();
+}