Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging proto along with google wrappers value attribute #20044

Open
papanisaicharan opened this issue Jan 20, 2025 · 0 comments
Open

Logging proto along with google wrappers value attribute #20044

papanisaicharan opened this issue Jan 20, 2025 · 0 comments
Labels
untriaged auto added to all issues by default when created.

Comments

@papanisaicharan
Copy link

papanisaicharan commented Jan 20, 2025

What language does this apply to?
Java

Describe the problem you are trying to solve.
I have a proto message like below & trying to convert into JSON using JsonFormat.

message Prerequisites {
  google.protobuf.StringValue type = 1; 
}
Prerequisites prereq = getPrerequistes(); // return Prerequisites proto object
JsonFormat.Printer printer = JsonFormat.printer()
                .omittingInsignificantWhitespace()
                .preservingProtoFieldNames()
                .includingDefaultValueFields();

String protoRequest = printer.print(prereq)

protoRequest is looking like below:

{
  "type": "hello"
}

But I am expecting to print like below:

{
  "type": {
    "value": "hello"
  }
}

What are available options to configure to print like above?
If there is no solution. Can we please plan to have this in the coming versions?

Describe the solution you'd like
I haven't thought decided on the solution. Just trying to check if there is a solution

Describe alternatives you've considered
At the moment - none

Additional context
Add any other context or screenshots about the feature request here.
Scenario: We created a new gRPC service. We have an existing REST API JSON payload, and with the help of mappers, we were able to convert it to proto. However, when logging the proto payload (which we plan to use for making the RPC call) as JSON, it is not logging with the exact structure.

@papanisaicharan papanisaicharan added the untriaged auto added to all issues by default when created. label Jan 20, 2025
@papanisaicharan papanisaicharan changed the title Log proto that contains google wrappers Logging proto that contains google wrappers Jan 20, 2025
@papanisaicharan papanisaicharan changed the title Logging proto that contains google wrappers Logging proto along with google wrappers value attribute Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged auto added to all issues by default when created.
Projects
None yet
Development

No branches or pull requests

1 participant