Incorrect JSON deserialization in `handleOneWayDeviceRPCRequestV2WithHttpInfo`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Search the generated client for handleOneWayDeviceRPCRequestV2WithHttpInfo and inspect its response deserialization. Compare the expected JSON object containing rpcId with the current String deserialization, then verify that the method returns the rpcId without MismatchedInputException for that response.
Written by the indexing model from the issue text.
Description
Using ThingsBoard CE 4.3.1.3 with thingsboard-client-ce 4.3.1.3, an exception occurs in the generated client method:
handleOneWayDeviceRPCRequestV2WithHttpInfo
Exception
com.fasterxml.jackson.databind.exc.MismatchedInputException:
Cannot deserialize value of type `java.lang.String` from Object value
(token `JsonToken.START_OBJECT`)
Cause
The response body is a JSON object containing the rpcId, but the client attempts to deserialize the entire response directly into a String:
String responseValue = responseBody.isBlank()
? null
: memberVarObjectMapper.readValue(
responseBody,
new TypeReference<String>() {}
);
return new ApiResponse<String>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseValue
);
This fails when the API response is an object such as:
{
"rpcId": "..."
}
Proposed fix
Extract the rpcId field from the JSON response instead:
String responseValue = responseBody.isBlank()
? null
: memberVarObjectMapper.readTree(responseBody).get("rpcId").asText();
return new ApiResponse<String>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseValue
);
This correctly handles the object response and returns the rpcId as the expected String.
Expected result
handleOneWayDeviceRPCRequestV2WithHttpInfo should successfully deserialize the RPC response and return the rpcId without throwing MismatchedInputException.
- Dominant language
- Java
- Stars
- 2
- Forks
- 2
- Avg merge
- 1m
- Merged PRs (30d)
- 5
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100