Skip to content

[Java] [vertx] Make supportVertxFuture compatible with vertx 5#23660

Open
RickyRister wants to merge 4 commits intoOpenAPITools:masterfrom
RickyRister:vertx5-supportVertxFuture
Open

[Java] [vertx] Make supportVertxFuture compatible with vertx 5#23660
RickyRister wants to merge 4 commits intoOpenAPITools:masterfrom
RickyRister:vertx5-supportVertxFuture

Conversation

@RickyRister
Copy link
Copy Markdown
Contributor

@RickyRister RickyRister commented Apr 29, 2026

Closes #23659

In vertx 5, Promise no longer extends Handler<AsyncResult>, which means we can't directly pass in a promise into an arg that accepts a handler. However, promise::handle still works, in both versions of vertx.

Also added a new sample java-vertx5-supportVertxFuture to the samples.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @martin-mfg (2023/08)


Summary by cubic

Make supportVertxFuture compatible with Vert.x 5 by switching generated calls to promise::handle, keeping Vert.x 4 support. Adds a Vert.x 5 Petstore sample and updates CI to build it.

  • Bug Fixes

    • In Java/libraries/vertx/api.mustache, use promise::handle in default Future helpers (and auth variants) instead of passing the Promise directly.
    • Update existing samples/client/petstore/java/vertx-supportVertxFuture APIs to use promise::handle.
  • New Features

    • Add Vert.x 5 sample: samples/client/petstore/java/vertx5-supportVertxFuture with config bin/configs/java-vertx5-supportVertxFuture.yaml (useVertx5: "true", supportVertxFuture: "true").
    • CI: include the new sample in .github/workflows/samples-java-client-jdk11.yaml.

Written for commit 5726692. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 issues found across 231 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed. cubic prioritises the most important files to review.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="samples/client/petstore/java/vertx5-supportVertxFuture/docs/FakeClassnameTags123Api.md">

<violation number="1" location="samples/client/petstore/java/vertx5-supportVertxFuture/docs/FakeClassnameTags123Api.md:13">
P2: Vert.x future-mode docs still present a synchronous `Client` return and `ApiException` try/catch, but the generated API returns `Future<Client>`; the sample code is incorrect and will not compile as written.</violation>
</file>

<file name="samples/client/petstore/java/vertx5-supportVertxFuture/docs/EnumArrays.md">

<violation number="1" location="samples/client/petstore/java/vertx5-supportVertxFuture/docs/EnumArrays.md:11">
P3: Broken internal anchor for the `arrayEnum` enum section; the fragment will not match the generated heading id.</violation>
</file>

<file name="samples/client/petstore/java/vertx5-supportVertxFuture/docs/MapTest.md">

<violation number="1" location="samples/client/petstore/java/vertx5-supportVertxFuture/docs/MapTest.md:11">
P3: Broken intra-document enum link: the fragment does not match the generated heading anchor.</violation>
</file>

<file name="samples/client/petstore/java/vertx5-supportVertxFuture/docs/DefaultApi.md">

<violation number="1" location="samples/client/petstore/java/vertx5-supportVertxFuture/docs/DefaultApi.md:13">
P2: Docs for the Vert.x Future sample still show a synchronous `fooGet()`/`ApiException` example, but the actual API returns `Future<FooGetDefaultResponse>`, so the snippet is inaccurate and misleading.</violation>
</file>

<file name="samples/client/petstore/java/vertx5-supportVertxFuture/.travis.yml">

<violation number="1" location="samples/client/petstore/java/vertx5-supportVertxFuture/.travis.yml:9">
P2: The Travis matrix includes JDK 8/9/10 even though this Vert.x 5 sample is Java 11-only, so those CI jobs will fail deterministically.</violation>
</file>

<file name="samples/client/petstore/java/vertx5-supportVertxFuture/docs/AnotherFakeApi.md">

<violation number="1" location="samples/client/petstore/java/vertx5-supportVertxFuture/docs/AnotherFakeApi.md:37">
P2: Docs example uses a synchronous `Client`/`ApiException` pattern for a Future-returning Vert.x 5 API.</violation>
</file>

<file name="samples/client/petstore/java/vertx5-supportVertxFuture/git_push.sh">

<violation number="1" location="samples/client/petstore/java/vertx5-supportVertxFuture/git_push.sh:48">
P1: Embedding `GIT_TOKEN` in the remote URL stores the secret in Git config and can expose it through remote listings/logs.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Embedding GIT_TOKEN in the remote URL stores the secret in Git config and can expose it through remote listings/logs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/vertx5-supportVertxFuture/git_push.sh, line 48:

<comment>Embedding `GIT_TOKEN` in the remote URL stores the secret in Git config and can expose it through remote listings/logs.</comment>

<file context>
@@ -0,0 +1,57 @@
+        echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+        git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+    else
+        git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
+    fi
+
</file context>

@@ -0,0 +1,82 @@
# FakeClassnameTags123Api
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Vert.x future-mode docs still present a synchronous Client return and ApiException try/catch, but the generated API returns Future<Client>; the sample code is incorrect and will not compile as written.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/vertx5-supportVertxFuture/docs/FakeClassnameTags123Api.md, line 13:

<comment>Vert.x future-mode docs still present a synchronous `Client` return and `ApiException` try/catch, but the generated API returns `Future<Client>`; the sample code is incorrect and will not compile as written.</comment>

<file context>
@@ -0,0 +1,82 @@
+
+## testClassname
+
+> Client testClassname(client)
+
+To test class name in snake case
</file context>


## fooGet

> FooGetDefaultResponse fooGet()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Docs for the Vert.x Future sample still show a synchronous fooGet()/ApiException example, but the actual API returns Future<FooGetDefaultResponse>, so the snippet is inaccurate and misleading.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/vertx5-supportVertxFuture/docs/DefaultApi.md, line 13:

<comment>Docs for the Vert.x Future sample still show a synchronous `fooGet()`/`ApiException` example, but the actual API returns `Future<FooGetDefaultResponse>`, so the snippet is inaccurate and misleading.</comment>

<file context>
@@ -0,0 +1,69 @@
+
+## fooGet
+
+> FooGetDefaultResponse fooGet()
+
+
</file context>

@@ -0,0 +1,22 @@
#
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The Travis matrix includes JDK 8/9/10 even though this Vert.x 5 sample is Java 11-only, so those CI jobs will fail deterministically.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/vertx5-supportVertxFuture/.travis.yml, line 9:

<comment>The Travis matrix includes JDK 8/9/10 even though this Vert.x 5 sample is Java 11-only, so those CI jobs will fail deterministically.</comment>

<file context>
@@ -0,0 +1,22 @@
+language: java
+jdk:
+  - openjdk12
+  - openjdk11
+  - openjdk10
+  - openjdk9
</file context>
Suggested change
#
- openjdk11

AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
Client client = new Client(); // Client | client model
try {
Client result = apiInstance.call123testSpecialTags(client);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Docs example uses a synchronous Client/ApiException pattern for a Future-returning Vert.x 5 API.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/vertx5-supportVertxFuture/docs/AnotherFakeApi.md, line 37:

<comment>Docs example uses a synchronous `Client`/`ApiException` pattern for a Future-returning Vert.x 5 API.</comment>

<file context>
@@ -0,0 +1,75 @@
+        AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
+        Client client = new Client(); // Client | client model
+        try {
+            Client result = apiInstance.call123testSpecialTags(client);
+            System.out.println(result);
+        } catch (ApiException e) {
</file context>

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] |
|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#List&lt;ArrayEnumEnum&gt;) | | [optional] |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Broken internal anchor for the arrayEnum enum section; the fragment will not match the generated heading id.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/vertx5-supportVertxFuture/docs/EnumArrays.md, line 11:

<comment>Broken internal anchor for the `arrayEnum` enum section; the fragment will not match the generated heading id.</comment>

<file context>
@@ -0,0 +1,32 @@
+| Name | Type | Description | Notes |
+|------------ | ------------- | ------------- | -------------|
+|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) |  |  [optional] |
+|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#List&lt;ArrayEnumEnum&gt;) |  |  [optional] |
+
+
</file context>
Suggested change
|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#List&lt;ArrayEnumEnum&gt;) | | [optional] |
|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#enum-listarrayenumenum) | | [optional] |

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**mapMapOfString** | **Map&lt;String, Map&lt;String, String&gt;&gt;** | | [optional] |
|**mapOfEnumString** | [**Map&lt;String, InnerEnum&gt;**](#Map&lt;String, InnerEnum&gt;) | | [optional] |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Broken intra-document enum link: the fragment does not match the generated heading anchor.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/vertx5-supportVertxFuture/docs/MapTest.md, line 11:

<comment>Broken intra-document enum link: the fragment does not match the generated heading anchor.</comment>

<file context>
@@ -0,0 +1,25 @@
+| Name | Type | Description | Notes |
+|------------ | ------------- | ------------- | -------------|
+|**mapMapOfString** | **Map&lt;String, Map&lt;String, String&gt;&gt;** |  |  [optional] |
+|**mapOfEnumString** | [**Map&lt;String, InnerEnum&gt;**](#Map&lt;String, InnerEnum&gt;) |  |  [optional] |
+|**directMap** | **Map&lt;String, Boolean&gt;** |  |  [optional] |
+|**indirectMap** | **Map&lt;String, Boolean&gt;** |  |  [optional] |
</file context>
Suggested change
|**mapOfEnumString** | [**Map&lt;String, InnerEnum&gt;**](#Map&lt;String, InnerEnum&gt;) | | [optional] |
|**mapOfEnumString** | [**Map&lt;String, InnerEnum&gt;**](#enum-mapstring-innerenum) | | [optional] |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [Java] [vertx] supportVertxFuture incompatible with vertx 5

1 participant