swagger-api / swagger-api/swagger-codegen

[JAVA][library: vertx] generated client does not maintain backwards compatibility with older versions of vertx

Open
#8,588 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The buildResponseHandler method defined in Java/libraries/vertx/ApiClient.mustache makes a call to Json.decodeValue(String, Class<T>) which is not supported in older versions (< 3.5) of Vert.x. The call should be adjusted to handle all versions.

Swagger-codegen version

All versions with vertx async & rx support

Suggest a fix/enhancement

Change the call from:

resultContent = Json.decodeValue(httpResponse.body(), returnType);

to:

try {
   resultContent = Json.mapper.readValue(httpResponse.bodyAsString(), returnType);
} catch (Exception e) {
   throw new DecodeException("Failed to decode:" + e.getMessage(), e);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Java/libraries/vertx/ApiClient.mustache and inspect the buildResponseHandler method and its response-decoding path. Check how generated clients handle Vert.x versions below 3.5, then verify that generated Vert.x clients retain compatibility with those versions and that decoding failures remain represented by the expected exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.