temporalio / temporalio/sdk-java
ProtobufJsonPayloadConverter does not work correctly with shaded artifact
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Expected Behavior
The ProtobufJsonPayloadConverter does not work correctly when using the shaded Temporal artifact, which is sometimes necessary to avoid gRPC version conflicts.
Here, MessageOrBuilder is rewritten in the byte-code to be io.temporal.shaded.com.google.protobuf.MessageOrBuilder, and so passing in a non-shaded value (as certainly client code will be using) fails, and the converter fails to convert the value.
The converter, whether it is shaded or not, should correctly recognize protobuf values coming from client code.
Actual Behavior
Protobuf values coming from client code are ignored, and serialization fails.
Steps to Reproduce the Problem
Using the shaded temporal artifact, run this code:
import com.google.protobuf.StringValue;
import io.temporal.common.converter.ProtobufJsonPayloadConverter;
class Test {
public static void main(String[] args) {
var converter = new ProtobufJsonPayloadConverter();
var msg = StringValue.of("hello");
var payloadOpt = converter.toData(msg);
System.out.println(payloadOpt.isPresent());
}
}
We can see that the payload is not present.
Specifications
- Version: 1.32.1
- Platform: N/A
Contributor guide
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.
Research direction
Start with temporal-sdk/src/main/java/io/temporal/common/converter/ProtobufJsonPayloadConverter.java at the MessageOrBuilder check described in the issue. Run the shaded-artifact reproduction using StringValue.of("hello") and verify the converter's payload result. Done means protobuf values from client code are recognized and the reproduction reports a present payload in the shaded artifact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100