protobuf.Text icon indicating copy to clipboard operation
protobuf.Text copied to clipboard

Timestamp (Well known type) is written incorrectly

Open csperl opened this issue 5 years ago • 2 comments

I have a proto with a google.protobuf.Timestamp field with the name date. When calling TextFormatter I get the following text:

date {
"2020-12-04T12:40:43.910002200Z"
}

I get an exception when I try to parse this text again into the proto: Expected string value for Timestamp. It expects the following format:

date: "2020-12-04T12:40:43.910002200Z"

Parsing the textproto file worked after manually changing it.

I suggest to update the formatter and not the parser. The currently produced text is weird, because the braces indicate a complex type, but then they only contain a single value without a name.

csperl avatar Dec 05 '20 13:12 csperl

Any update?

@kerryjiang Are you working on a fix?

csperl avatar Jan 04 '21 13:01 csperl

Could you try the new version I just released just now? https://www.nuget.org/packages/Protobuf.Text/0.5.0

kerryjiang avatar Feb 01 '21 05:02 kerryjiang