thesayyn / protoc-gen-ts

Compile protocol buffer messages to TypeScript.
MIT License
360 stars 74 forks source link

Serialized result is inconsistent with Go #172

Closed shaneing closed 11 months ago

shaneing commented 2 years ago

The message is as follows:

message SignDoc {
    uint64 account_number = 1;
}

And run the following code:

func main() {
    doc := pb.SignDoc{
        AccountNumber: 0,
    }
    bytes, _ := proto.Marshal(&doc)
    fmt.Println(bytes)
}

The output is as follows:

[]

The output is different from the serialized result [32, 0] in TypeScript.

thesayyn commented 2 years ago

This is due to defaults being serialized. one of PRs that @Santalov put together is going to fix this.

thesayyn commented 11 months ago

This is fixed with the rust rewrite as we conform to protobuf conformance tests!