diff --git a/quarkus-asyncapi-scanner/deployment/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScanner.java b/quarkus-asyncapi-scanner/deployment/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScanner.java index af58320..bd909fa 100644 --- a/quarkus-asyncapi-scanner/deployment/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScanner.java +++ b/quarkus-asyncapi-scanner/deployment/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScanner.java @@ -58,6 +58,8 @@ import io.quarkiverse.asyncapi.annotation.scanner.config.Channel; import io.quarkiverse.asyncapi.annotation.scanner.kafka.binding.KafkaResolver; +import io.smallrye.mutiny.Multi; +import io.smallrye.mutiny.Uni; /** * @since 09.02.2023 @@ -273,10 +275,19 @@ public ChannelData(AnnotationInstance aAnnotationInstance, ResolveType aType) { } } - final Type resolveType(Type aFirstParameterType) { - return aFirstParameterType.kind().equals(PARAMETERIZED_TYPE) - ? aFirstParameterType.asParameterizedType() - : aFirstParameterType; + final Type resolveType(Type aType) { + Type bType = aType; + if (DotName.createSimple(Uni.class).equals(aType.name()) + || DotName.createSimple(Multi.class).equals(aType.name())) { + bType = aType.asParameterizedType().arguments().get(0); + } + if (DotName.createSimple("org.eclipse.microprofile.reactive.messaging.Message").equals(bType.name())) { + bType = bType.asParameterizedType().arguments().get(0); + } + Type type = bType.kind().equals(PARAMETERIZED_TYPE) + ? bType.asParameterizedType() + : bType; + return type; } } diff --git a/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/DummyController.java b/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/DummyController.java index f50c445..776204e 100644 --- a/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/DummyController.java +++ b/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/java/io/quarkiverse/asyncapi/annotation/scanner/DummyController.java @@ -5,14 +5,12 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import org.eclipse.microprofile.reactive.messaging.Channel; -import org.eclipse.microprofile.reactive.messaging.Emitter; -import org.eclipse.microprofile.reactive.messaging.Incoming; -import org.eclipse.microprofile.reactive.messaging.Outgoing; +import org.eclipse.microprofile.reactive.messaging.*; import org.reactivestreams.Publisher; import io.quarkiverse.asyncapi.annotation.Schema; import io.smallrye.mutiny.Multi; +import io.smallrye.mutiny.Uni; import io.smallrye.reactive.messaging.annotations.Broadcast; /** @@ -66,6 +64,12 @@ public GecMessage sendMessageTyped() { return null; } + @Outgoing("outgoing-channel-reactive-part") + public Uni> sendReactiveMessageTyped() { + //Do nothing + return null; + } + //Ignore internal channels that have no application.properties @Channel("prices-intern") Multi pricesIntern; diff --git a/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/resources/application.properties b/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/resources/application.properties index 9c9517a..a8e8ca3 100644 --- a/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/resources/application.properties +++ b/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/main/resources/application.properties @@ -36,6 +36,10 @@ mp.messaging.outgoing.outgoing-channel-part.connector=smallrye-kafka mp.messaging.outgoing.outgoing-channel-part.topic=outgoing-channel-part-topic mp.messaging.outgoing.outgoing-channel-part.value.serializer=org.apache.kafka.common.serialization.StringSerializer +mp.messaging.outgoing.outgoing-channel-reactive-part.connector=smallrye-kafka +mp.messaging.outgoing.outgoing-channel-reactive-part.topic=outgoing-channel-reactive-part-topic +mp.messaging.outgoing.outgoing-channel-reactive-part.value.serializer=org.apache.kafka.common.serialization.StringSerializer + mp.messaging.incoming.prices.connector=smallrye-kafka # Set root path to / (all resources - inclusive html pages are) diff --git a/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/test/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScannerUnFilteredTest.java b/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/test/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScannerUnFilteredTest.java index 94e4dfb..5952ae8 100644 --- a/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/test/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScannerUnFilteredTest.java +++ b/quarkus-asyncapi-scanner/quarkus-asyncapi-scanner-tests/quarkus-asyncapi-scanner-tests-simple/src/test/java/io/quarkiverse/asyncapi/annotation/scanner/AsyncApiAnnotationScannerUnFilteredTest.java @@ -45,6 +45,10 @@ void shouldScanEmitterAnnotations() throws Exception { assertThat(oneOfOpenApiNodeOneOf.get(0).get("type").asText()).isEqualTo("string"); assertThat(oneOfOpenApiNodeOneOf.get(1).get("type").asText()).isEqualTo("integer"); + //Uni> + assertThat(asyncAPI.at("/channels/outgoing-channel-reactive-part/publish/message/payload/$ref").asText()) + .isEqualTo("#/components/schemas/Part"); + //JsonGetter assertThat(asyncAPI.at("/channels/channel-x/publish/message/payload/properties/i18n/description").asText()) .isNotEmpty();