MobilityData / gtfs-realtime-bindings

Language bindings generated from the GTFS Realtime protocol buffer spec for popular languages.
Apache License 2.0
370 stars 127 forks source link

Proposal: javascript: timestamps as numbers instead of int64 type representation #102

Closed thommee closed 1 year ago

thommee commented 1 year ago

Currently timestamps (int64) are decoded as objects with "low", "high", and "unsigned" properties. This PR changes this behavior.

Before:

{
    timestamp: {
        low: 1667665624,
        high: 0,
        unsigned: true
    }
}

After:

{
    timestamp: 1667665624
}
CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

jameslinjl commented 1 year ago

Hi @Thommee ! It looks like you may have made the changes to the JS file by hand? I'm new to this project, but I have worked with protobuf a fair amount, and the target code should always be updated via the codegen tool. It also isn't recommended to have int64 types from protobufs converted into potentially unsafe types (I'm of the understanding that number is still technically unsafe because some JS engines will still not properly support 64-bit integers)