From 73252ede0f64cf1a29105788015a7b04a689af17 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 11 Mar 2024 18:24:34 +0100 Subject: [PATCH 1/3] Fix RESTEasy Client codestart for 3.8 Fixes #39330 --- .../rest-client-codestart/codestart.yml | 13 ------------- .../base/README.tpl.qute.md | 0 .../resteasy-client-codestart/codestart.yml | 13 +++++++++++++ .../src/main/java/org/acme/MyRemoteService.java | 0 .../src/main/kotlin/org/acme/MyRemoteService.kt | 0 .../main/resources/META-INF/quarkus-extension.yaml | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml rename devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/{rest-client-codestart => resteasy-client-codestart}/base/README.tpl.qute.md (100%) create mode 100644 devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/codestart.yml rename devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/{rest-client-codestart => resteasy-client-codestart}/java/src/main/java/org/acme/MyRemoteService.java (100%) rename devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/{rest-client-codestart => resteasy-client-codestart}/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt (100%) diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml deleted file mode 100644 index 067c3561eecbf..0000000000000 --- a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: rest-client-codestart -ref: rest-client -type: code -tags: extension-codestart -metadata: - title: REST Client - description: Invoke different services through REST with JSON - related-guide-section: https://quarkus.io/guides/rest-client -language: - base: - dependencies: - - io.quarkus:quarkus-rest-client - - io.quarkus:quarkus-rest-client-jackson diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/base/README.tpl.qute.md b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/base/README.tpl.qute.md similarity index 100% rename from devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/base/README.tpl.qute.md rename to devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/base/README.tpl.qute.md diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/codestart.yml b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/codestart.yml new file mode 100644 index 0000000000000..e6dcd5d440941 --- /dev/null +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/codestart.yml @@ -0,0 +1,13 @@ +name: resteasy-client-codestart +ref: resteasy-client +type: code +tags: extension-codestart +metadata: + title: RESTEasy Client + description: Invoke different services through REST with JSON + related-guide-section: https://quarkus.io/guides/resteasy-client +language: + base: + dependencies: + - io.quarkus:quarkus-resteasy-client + - io.quarkus:quarkus-resteasy-client-jackson diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/java/src/main/java/org/acme/MyRemoteService.java b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/java/src/main/java/org/acme/MyRemoteService.java similarity index 100% rename from devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/java/src/main/java/org/acme/MyRemoteService.java rename to devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/java/src/main/java/org/acme/MyRemoteService.java diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt similarity index 100% rename from devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt rename to devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/resteasy-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt diff --git a/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 709a305eef669..1bec3490ede35 100644 --- a/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -10,7 +10,7 @@ metadata: categories: - "web" codestart: - name: "rest-client" + name: "resteasy-client" languages: - "java" - "kotlin" From 43ee48b4d303e24e9a57d6db26f221c2f2f571d8 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 11 Mar 2024 18:59:52 +0100 Subject: [PATCH 2/3] Add a quickstart for the default REST Client Let's make it consistent with the RESTEasy Client --- .../base/README.tpl.qute.md | 1 + .../rest-client-codestart/codestart.yml | 13 +++++++ .../main/java/org/acme/MyRemoteService.java | 37 +++++++++++++++++++ .../main/kotlin/org/acme/MyRemoteService.kt | 29 +++++++++++++++ .../resources/META-INF/quarkus-extension.yaml | 4 +- 5 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/base/README.tpl.qute.md create mode 100644 devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml create mode 100644 devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/java/src/main/java/org/acme/MyRemoteService.java create mode 100644 devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/base/README.tpl.qute.md b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/base/README.tpl.qute.md new file mode 100644 index 0000000000000..405280158877d --- /dev/null +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/base/README.tpl.qute.md @@ -0,0 +1 @@ +{#include readme-header /} \ No newline at end of file diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml new file mode 100644 index 0000000000000..067c3561eecbf --- /dev/null +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/codestart.yml @@ -0,0 +1,13 @@ +name: rest-client-codestart +ref: rest-client +type: code +tags: extension-codestart +metadata: + title: REST Client + description: Invoke different services through REST with JSON + related-guide-section: https://quarkus.io/guides/rest-client +language: + base: + dependencies: + - io.quarkus:quarkus-rest-client + - io.quarkus:quarkus-rest-client-jackson diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/java/src/main/java/org/acme/MyRemoteService.java b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/java/src/main/java/org/acme/MyRemoteService.java new file mode 100644 index 0000000000000..9cc8e8ba1e27c --- /dev/null +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/java/src/main/java/org/acme/MyRemoteService.java @@ -0,0 +1,37 @@ +package org.acme; + +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.QueryParam; +import java.util.List; +import java.util.Set; + +/** + * To use it via injection. + * + * {@code + * @Inject + * @RestClient + * MyRemoteService myRemoteService; + * + * public void doSomething() { + * Set restClientExtensions = myRemoteService.getExtensionsById("io.quarkus:quarkus-hibernate-validator"); + * } + * } + */ +@RegisterRestClient(baseUri = "https://stage.code.quarkus.io/api") +public interface MyRemoteService { + + @GET + @Path("/extensions") + Set getExtensionsById(@QueryParam("id") String id); + + class Extension { + public String id; + public String name; + public String shortName; + public List keywords; + } +} diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt new file mode 100644 index 0000000000000..e28a0ae228c7d --- /dev/null +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/rest-client-codestart/kotlin/src/main/kotlin/org/acme/MyRemoteService.kt @@ -0,0 +1,29 @@ +package org.acme + +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient +import jakarta.ws.rs.GET +import jakarta.ws.rs.Path +import jakarta.ws.rs.QueryParam + +/** + * To use it via injection. + * + * ```kotlin + * @Inject + * @RestClient + * lateinit var myRemoteService: MyRemoteService + * + * fun doSomething() { + * val restClientExtensions = myRemoteService.getExtensionsById("io.quarkus:quarkus-rest-client") + * } + * ``` + */ +@RegisterRestClient(baseUri = "https://stage.code.quarkus.io/api") +interface MyRemoteService { + + @GET + @Path("/extensions") + fun getExtensionsById(@QueryParam("id") id: String): Set + + data class Extension(val id: String, val name: String, val shortName: String, val keywords: List) +} diff --git a/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml index de79bd08bce04..89f5ea5e860c9 100644 --- a/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -12,12 +12,10 @@ metadata: status: "stable" guide: "https://quarkus.io/guides/rest-client" codestart: - name: "rest" - kind: "core" + name: "rest-client" languages: - "java" - "kotlin" - - "scala" artifact: "io.quarkus:quarkus-project-core-extension-codestarts" config: - "quarkus.rest-client-reactive." From ba3232f932a61293a08ffec72a235523626ace2d Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 11 Mar 2024 19:19:30 +0100 Subject: [PATCH 3/3] REST - Adjust config section of quarkus-extension.yaml --- .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 1 + .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 1 + .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 1 + .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 1 + .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 2 ++ .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 1 + .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 1 + .../runtime/src/main/resources/META-INF/quarkus-extension.yaml | 1 + 8 files changed, 9 insertions(+) diff --git a/extensions/oidc-client-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/oidc-client-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml index cf02bb14353a5..fe65750f3d012 100644 --- a/extensions/oidc-client-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/oidc-client-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -13,4 +13,5 @@ metadata: - "security" status: "stable" config: + - "quarkus.resteasy-client-oidc-filter." - "quarkus.oidc-client." diff --git a/extensions/oidc-client-reactive-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/oidc-client-reactive-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml index cf22d9fc62814..170a93a2aabf9 100644 --- a/extensions/oidc-client-reactive-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/oidc-client-reactive-filter/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -14,4 +14,5 @@ metadata: - "security" status: "stable" config: + - "quarkus.rest-client-oidc-filter." - "quarkus.oidc-client." diff --git a/extensions/oidc-token-propagation-reactive/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/oidc-token-propagation-reactive/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 352129c550753..a5d8a019ec4c7 100644 --- a/extensions/oidc-token-propagation-reactive/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/oidc-token-propagation-reactive/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -13,4 +13,5 @@ metadata: - "security" status: "stable" config: + - "quarkus.rest-client-oidc-token-propagation." - "quarkus.oidc-token-propagation-reactive." diff --git a/extensions/oidc-token-propagation/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/oidc-token-propagation/runtime/src/main/resources/META-INF/quarkus-extension.yaml index cc4562d2a44d3..e6b925428f535 100644 --- a/extensions/oidc-token-propagation/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/oidc-token-propagation/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -13,4 +13,5 @@ metadata: - "security" status: "stable" config: + - "quarkus.resteasy-client-token-propagation." - "quarkus.oidc-token-propagation." diff --git a/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 1bec3490ede35..fc1644726eeb3 100644 --- a/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/resteasy-classic/resteasy-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -15,3 +15,5 @@ metadata: - "java" - "kotlin" artifact: "io.quarkus:quarkus-project-core-extension-codestarts" + config: + - "quarkus.rest-client." diff --git a/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 89f5ea5e860c9..a8ad2e19471cd 100644 --- a/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/resteasy-reactive/rest-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -18,4 +18,5 @@ metadata: - "kotlin" artifact: "io.quarkus:quarkus-project-core-extension-codestarts" config: + - "quarkus.rest-client." - "quarkus.rest-client-reactive." diff --git a/extensions/resteasy-reactive/rest-csrf/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/resteasy-reactive/rest-csrf/runtime/src/main/resources/META-INF/quarkus-extension.yaml index aad1faa0ff523..a576f45f71929 100644 --- a/extensions/resteasy-reactive/rest-csrf/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/resteasy-reactive/rest-csrf/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -8,4 +8,5 @@ metadata: - "security" status: "preview" config: + - "quarkus.rest-csrf." - "quarkus.csrf-reactive." diff --git a/extensions/resteasy-reactive/rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/resteasy-reactive/rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 87e3d17f36ba6..b7856a066ba1e 100644 --- a/extensions/resteasy-reactive/rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/resteasy-reactive/rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -20,4 +20,5 @@ metadata: - "scala" artifact: "io.quarkus:quarkus-project-core-extension-codestarts" config: + - "quarkus.rest." - "quarkus.resteasy-reactive."