-
Notifications
You must be signed in to change notification settings - Fork 88
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
[PROJECT] New proto-backed Firestore structure #1758
Comments
Did some research on various protoc plugins for generating js+ts code from protodef. We need something which makes metadata accessible (esp. field numbers) in order to implement the representation described in #2455. Here are my findings: protobufjs ✅The most popular lib I found (16M weekly downloads), originally designed by Google. It can generate js and ts, but to get what we want you need to call it three times - once to generate the js, once to generate to ts bindings, and once to generate JSON with pb metadata.
We could load the JSON at runtime to pick out field numbers we need. Alternatives considered@protobuf-ts/plugin146k downloads/week. Generates pure ts code in a single command, and includes field numbers in the message metadata. But given this is a less "standard", less used library, prefer using ts-protoOTOO 300k weekly downloads, and doesn't encode the field numbers anywhere we can use at runtime, so we can exclude this one for now. protoc-gen-tsIt seems the
It doesn't produce or consume JSON, but it's fairly easy to go from ts object<>JSON anyway, plus we'll prob want more control over the formats. grpc_tools_node_protoc_tsOnly 100k downloads per week, but uses the standard google grpc-tools. Doesn't seem to embed the set of valid field numbers, though individual fields can be fetched by field number:
|
Also, carrying forward proposal from google/ground-android#2455:
Example survey data before: {
"title": "My survey",
"description": "An example survey",
//...
} Example survey data after: {
1: "My survey",
2: "An example survey",
...
} This has several advantages:
This has a few disadvantages as well:
|
Yes, I think we can! |
Parent issue tracking the work needed to introduce protos as our db and Firestore schema.
Additional tasks related to this migration:
minAccuracyMeters
set to null #1922The text was updated successfully, but these errors were encountered: