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

use ProtoBuf.js? #6

Closed
derhuerst opened this issue Jun 28, 2021 · 0 comments
Closed

use ProtoBuf.js? #6

derhuerst opened this issue Jun 28, 2021 · 0 comments
Assignees
Labels
breaking breaking change

Comments

@derhuerst
Copy link
Owner

related: derhuerst/hafas-gtfs-rt-feed#4

pbf parses missing optional fields as not missing and 0 (mafintosh/protocol-buffers#20).

One option is to use ProtoBuf.js using the --keep-case build flag.

const {Position} = require('gtfs-realtime-bindings').transit_realtime

const p = {latitude: 1.23, longitude: 2.34}
Position.verify(p)
// null
const buf = Position.encode(p).finish()
Position.decode(buf)
// Position {
//  latitude: 1.2300000190734863,
//  longitude: 2.3399999141693115
// }
Position.toObject(Position.decode(buf))
// { latitude: 1.2300000190734863, longitude: 2.3399999141693115 }
@derhuerst derhuerst added the breaking breaking change label Jun 28, 2021
@derhuerst derhuerst self-assigned this Jun 28, 2021
derhuerst pushed a commit to stadtnavi/delay-prediction-service that referenced this issue Jun 28, 2021
derhuerst pushed a commit to stadtnavi/delay-prediction-service that referenced this issue Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking breaking change
Projects
None yet
Development

No branches or pull requests

1 participant