From 90254db922d3244fb6b69f5bd1db6f134745efb8 Mon Sep 17 00:00:00 2001 From: Jan Martiska Date: Fri, 4 Nov 2022 09:08:33 +0100 Subject: [PATCH 1/5] SmallRye GraphQL 1.8.3, set the global vertx instance for graphql clients (cherry picked from commit e3b5283c176a6a7bfe2b2ff9fcb603eb59c1d708) --- bom/application/pom.xml | 2 +- .../client/deployment/SmallRyeGraphQLClientProcessor.java | 8 ++++++++ .../client/runtime/SmallRyeGraphQLClientRecorder.java | 6 ++++++ jakarta/rewrite.yml | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index b5e8dc7ca25ea..72c6f12f5859c 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -44,7 +44,7 @@ 3.3.0 3.0.5 2.3.1 - 1.8.2 + 1.8.3 2.1.1 5.5.0 3.5.4 diff --git a/extensions/smallrye-graphql-client/deployment/src/main/java/io/quarkus/smallrye/graphql/client/deployment/SmallRyeGraphQLClientProcessor.java b/extensions/smallrye-graphql-client/deployment/src/main/java/io/quarkus/smallrye/graphql/client/deployment/SmallRyeGraphQLClientProcessor.java index b71a17de3f8eb..9323e1eec539d 100644 --- a/extensions/smallrye-graphql-client/deployment/src/main/java/io/quarkus/smallrye/graphql/client/deployment/SmallRyeGraphQLClientProcessor.java +++ b/extensions/smallrye-graphql-client/deployment/src/main/java/io/quarkus/smallrye/graphql/client/deployment/SmallRyeGraphQLClientProcessor.java @@ -38,6 +38,7 @@ import io.quarkus.smallrye.graphql.client.runtime.GraphQLClientSupport; import io.quarkus.smallrye.graphql.client.runtime.GraphQLClientsConfig; import io.quarkus.smallrye.graphql.client.runtime.SmallRyeGraphQLClientRecorder; +import io.quarkus.vertx.core.deployment.CoreVertxBuildItem; public class SmallRyeGraphQLClientProcessor { @@ -205,4 +206,11 @@ ServiceProviderBuildItem overrideErrorMessageProvider() { return ServiceProviderBuildItem.allProvidersFromClassPath("io.smallrye.graphql.client.impl.ErrorMessageProvider"); } + @BuildStep + @Record(RUNTIME_INIT) + void setGlobalVertxInstance(CoreVertxBuildItem vertxBuildItem, + SmallRyeGraphQLClientRecorder recorder) { + recorder.setGlobalVertxInstance(vertxBuildItem.getVertx()); + } + } diff --git a/extensions/smallrye-graphql-client/runtime/src/main/java/io/quarkus/smallrye/graphql/client/runtime/SmallRyeGraphQLClientRecorder.java b/extensions/smallrye-graphql-client/runtime/src/main/java/io/quarkus/smallrye/graphql/client/runtime/SmallRyeGraphQLClientRecorder.java index 210a103da7a5d..d06dfbda954c1 100644 --- a/extensions/smallrye-graphql-client/runtime/src/main/java/io/quarkus/smallrye/graphql/client/runtime/SmallRyeGraphQLClientRecorder.java +++ b/extensions/smallrye-graphql-client/runtime/src/main/java/io/quarkus/smallrye/graphql/client/runtime/SmallRyeGraphQLClientRecorder.java @@ -10,6 +10,8 @@ import io.quarkus.runtime.annotations.Recorder; import io.smallrye.graphql.client.impl.GraphQLClientsConfiguration; import io.smallrye.graphql.client.typesafe.api.TypesafeGraphQLClientBuilder; +import io.smallrye.graphql.client.vertx.VertxManager; +import io.vertx.core.Vertx; @Recorder public class SmallRyeGraphQLClientRecorder { @@ -48,4 +50,8 @@ public void initializeConfigurationMergerBean() { merger.nothing(); } + public void setGlobalVertxInstance(Supplier vertx) { + VertxManager.setFromGlobal(vertx.get()); + } + } diff --git a/jakarta/rewrite.yml b/jakarta/rewrite.yml index fa12ff0bf5bd2..a29e0399386e0 100644 --- a/jakarta/rewrite.yml +++ b/jakarta/rewrite.yml @@ -573,7 +573,7 @@ recipeList: newValue: 6.0.0-RC4 - org.openrewrite.maven.ChangePropertyValue: key: smallrye-graphql.version - newValue: 2.0.0.RC12 + newValue: 2.0.0.RC13 - org.openrewrite.maven.ChangePropertyValue: key: smallrye-health.version newValue: 4.0.0 From 8c5bd6efc9a634a747264110cee2fecd56a87dd6 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 21 Nov 2022 10:28:10 +0200 Subject: [PATCH 2/5] Ensure proper generic type is used with RestResponse Fixes: #29336 (cherry picked from commit 1d8a05f5ac940599a32296c59e4ff6fd7a4adf2a) --- .../server/handlers/ResponseHandler.java | 3 --- .../io/quarkus/it/kotser/GreetingResource.kt | 11 ++++++++++ .../io/quarkus/it/kotser/ResourceTest.kt | 20 +++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ResponseHandler.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ResponseHandler.java index 5b1fd6b44ac4d..09b1e06eb60d7 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ResponseHandler.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/ResponseHandler.java @@ -99,9 +99,6 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti responseBuilder = fromResponse(existing); responseBuilder.entity(genericEntity.getEntity()); } else { - // TCK says to use the entity type as generic type if we return a response - if (existing.hasEntity() && (existing.getEntity() != null)) - requestContext.setGenericReturnType(existing.getEntity().getClass()); //TODO: super inefficient responseBuilder = fromResponse(existing); if ((result instanceof RestResponseImpl)) { diff --git a/integration-tests/kotlin-serialization/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt b/integration-tests/kotlin-serialization/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt index 8c1c052c5423f..9340add0ca808 100644 --- a/integration-tests/kotlin-serialization/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt +++ b/integration-tests/kotlin-serialization/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt @@ -4,6 +4,7 @@ import io.quarkus.it.kotser.model.Person import io.quarkus.it.kotser.model.Person2 import io.quarkus.runtime.annotations.RegisterForReflection import kotlinx.coroutines.flow.flowOf +import org.jboss.resteasy.reactive.RestResponse import java.lang.reflect.Method import javax.ws.rs.Consumes import javax.ws.rs.GET @@ -28,6 +29,16 @@ class GreetingResource { return Person("Jim Halpert") } + @Path("restResponse") + @GET + @Produces(MediaType.APPLICATION_JSON) + fun restResponse() = RestResponse.ok(Person("Jim Halpert")) + + @Path("restResponseList") + @GET + @Produces(MediaType.APPLICATION_JSON) + fun restResponseList() = RestResponse.ok(mutableListOf(Person("Jim Halpert"))) + @Path("unknownType") @GET @Produces(MediaType.APPLICATION_JSON) diff --git a/integration-tests/kotlin-serialization/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt b/integration-tests/kotlin-serialization/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt index 2ba7e650575ae..b08196a95935d 100644 --- a/integration-tests/kotlin-serialization/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt +++ b/integration-tests/kotlin-serialization/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt @@ -32,6 +32,26 @@ open class ResourceTest { } } + @Test + fun testRestResponse() { + When { + get("/restResponse") + } Then { + statusCode(200) + body(`is`("""{"name":"Jim Halpert","defaulted":"hi there!"}""")) + } + } + + @Test + fun testRestResponseList() { + When { + get("/restResponseList") + } Then { + statusCode(200) + body(`is`("""[{"name":"Jim Halpert","defaulted":"hi there!"}]""")) + } + } + @Test fun testGetUnknownType() { When { From 4e50b41c29eaf42b58f82a63f1357b68122f95b5 Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Mon, 21 Nov 2022 13:13:04 +0000 Subject: [PATCH 3/5] Move scm information to metadata from top-level, and remove nesting (cherry picked from commit 1a7563f915b17a7a97c583ac2470b200d80f24f0) --- .../extension/gradle/tasks/ExtensionDescriptorTask.java | 5 +++-- .../gradle/tasks/ExtensionDescriptorTaskTest.java | 7 +++---- .../java/io/quarkus/maven/ExtensionDescriptorMojo.java | 5 ++--- .../java/io/quarkus/maven/ExtensionDescriptorMojo.java | 5 +++-- .../java/io/quarkus/maven/ExtensionDescriptorMojoTest.java | 3 +-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java b/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java index 5b5b067b11b0d..c700936e4f733 100644 --- a/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java +++ b/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java @@ -313,9 +313,10 @@ private void computeArtifactCoords(ObjectNode extObject) { private void computeSourceLocation(ObjectNode extObject) { Map repo = ScmInfoProvider.getSourceRepo(); if (repo != null) { - ObjectNode scm = extObject.putObject("scm"); + ObjectNode metadata = getMetadataNode(extObject); + for (Map.Entry e : repo.entrySet()) { - scm.put(e.getKey(), e.getValue()); + metadata.put("scm-" + e.getKey(), e.getValue()); } } diff --git a/devtools/gradle/gradle-extension-plugin/src/test/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTaskTest.java b/devtools/gradle/gradle-extension-plugin/src/test/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTaskTest.java index c4d8acf9b22da..4bf80758222d0 100644 --- a/devtools/gradle/gradle-extension-plugin/src/test/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTaskTest.java +++ b/devtools/gradle/gradle-extension-plugin/src/test/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTaskTest.java @@ -200,10 +200,9 @@ public void shouldGenerateScmInformation() throws IOException { File extensionDescriptorFile = new File(testProjectDir, "build/resources/main/META-INF/quarkus-extension.yaml"); assertThat(extensionDescriptorFile).exists(); ObjectNode extensionDescriptor = TestUtils.readExtensionFile(extensionDescriptorFile.toPath()); - assertThat(extensionDescriptor.get("scm")).isNotNull(); - assertThat(extensionDescriptor.get("scm").get("url")).isNotNull(); - assertThat(extensionDescriptor.get("scm").get("url").asText()) - .as("Check source location %s", extensionDescriptor.get("scm")) + assertThat(extensionDescriptor.get("metadata").get("scm-url")).isNotNull(); + assertThat(extensionDescriptor.get("metadata").get("scm-url").asText()) + .as("Check source location %s", extensionDescriptor.get("scm-url")) .isEqualTo("https://github.com/some/repo"); } diff --git a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java index 330a716ca5414..851edeeb722cf 100644 --- a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java +++ b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java @@ -660,10 +660,9 @@ public boolean visitLeave(DependencyNode node) { private void addSource(ObjectNode extObject) throws MojoExecutionException { Map repo = getSourceRepo(); if (repo != null) { - ObjectNode scm = extObject.putObject("scm"); + ObjectNode metadata = getMetadataNode(extObject); for (Map.Entry e : repo.entrySet()) { - scm.put(e.getKey(), e.getValue()); - + metadata.put("scm-" + e.getKey(), e.getValue()); } } } diff --git a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java index 79c7599a78fe2..79240d2cfa5d5 100644 --- a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java +++ b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java @@ -676,9 +676,10 @@ public boolean visitLeave(DependencyNode node) { private void addSource(ObjectNode extObject) throws MojoExecutionException { Map repo = ScmInfoProvider.getSourceRepo(); if (repo != null) { - ObjectNode scm = extObject.putObject("scm"); + ObjectNode metadata = getMetadataNode(extObject); for (Map.Entry e : repo.entrySet()) { - scm.put(e.getKey(), e.getValue()); + // Tools may not be able to handle nesting in metadata, so do fake-nesting + metadata.put("scm-" + e.getKey(), e.getValue()); } } diff --git a/independent-projects/extension-maven-plugin/src/test/java/io/quarkus/maven/ExtensionDescriptorMojoTest.java b/independent-projects/extension-maven-plugin/src/test/java/io/quarkus/maven/ExtensionDescriptorMojoTest.java index 4d2b39a424d52..acbb2ca6fa75c 100644 --- a/independent-projects/extension-maven-plugin/src/test/java/io/quarkus/maven/ExtensionDescriptorMojoTest.java +++ b/independent-projects/extension-maven-plugin/src/test/java/io/quarkus/maven/ExtensionDescriptorMojoTest.java @@ -100,8 +100,7 @@ public void shouldCreateMetadata() // From maven this property should be set, running in an IDE it won't be unless specially configured if (System.getenv("GITHUB_REPOSITORY") != null) { // Lazily test that the scm is there but is an object - assertYamlContainsObject(fileContents, "scm"); - assertYamlContains(fileContents, "url", "https://github.com/some/repo"); + assertYamlContains(fileContents, "scm-url", "https://github.com/some/repo"); } } From ed2f2d94a70622402e9e56344819bbbc2969f9b8 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Mon, 21 Nov 2022 15:32:04 +0100 Subject: [PATCH 4/5] Use wildcards instead of null when creating dependency exclusions (cherry picked from commit 56547c9ab7d96ee5ee1bdfd5d9dba59b3e026810) --- devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index 181b505645e49..ac5bc0683a3e1 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -1268,7 +1268,7 @@ private void addQuarkusDevModeDeps(MavenDevModeLauncher.Builder builder, Applica final List exclusions; if (!d.getExclusions().isEmpty()) { exclusions = new ArrayList<>(d.getExclusions().size()); - d.getExclusions().forEach(e -> exclusions.add(new Exclusion(e.getGroupId(), e.getArtifactId(), null, null))); + d.getExclusions().forEach(e -> exclusions.add(new Exclusion(e.getGroupId(), e.getArtifactId(), "*", "*"))); } else { exclusions = List.of(); } From 8dac223cd2e609eb921349b01675bd43f96ad40b Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Mon, 21 Nov 2022 17:09:20 +0000 Subject: [PATCH 5/5] Update guide link in metadata The security-jpa guide has moved to https://quarkus.io/guides/security-getting-started, so we need to update the metadata in the extension yaml. (cherry picked from commit 01de89cae03d8334552d08030d603fce7ac155b4) --- .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/security-jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/security-jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 1d702d22c6fad..8d4d70da22e18 100644 --- a/extensions/security-jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/security-jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -7,7 +7,7 @@ metadata: - "jpa" - "orm" - "panache" - guide: "https://quarkus.io/guides/security-jpa" + guide: "https://quarkus.io/guides/security-getting-started" categories: - "security" status: "stable"