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

Generated text format is not readable by text_format lib in other languages. #3

Open
Gateswong opened this issue Jun 5, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Gateswong
Copy link

I generated a text file through this formatter with the following setups:

Proto

message SomeEntity {
  int64 temporary_id = 1;
  string temporary_name = 2;
}

message SomeRequest {
  SomeEntity entity = 1;
}

C# message object:

var request = new SomeRequest() {
  Entity = new SomeEntity() {
    TemporaryId = 5,
    TemporaryName = "dummy name",
  },
};

I serialized it to text and printed out:

using (StreamWriter writer = new StreamWriter(outputFile, false))
{
    writer.Write(request.ToText());
}

Now the output file looks like this:

entity {
temporary_id: "-5"
temporary_name: "dummy name"
}

I tried to parse this text file in python using text_format, and got the following error:

google.protobuf.text_format.ParseError: 2:15 : 'temporary_id: "-5"': Couldn't parse integer: "-5" 

In fact, the output integer should be:
temporary_id: -5
instead of
temporary_id: "-5"

@kerryjiang kerryjiang self-assigned this Jun 9, 2021
@kerryjiang kerryjiang added the bug Something isn't working label Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants