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

Add method to get field ids for a proto message class #1938

Merged
merged 17 commits into from
Aug 2, 2024

Conversation

gino-m
Copy link
Collaborator

@gino-m gino-m commented Jul 31, 2024

@rfontanarosa FYI

Usage:

import {registry} from '@ground/lib';
import {GroundProtos} from '@ground/proto';

import Pb = GroundProtos.google.ground.v1beta1;
const s = registry.getFieldIds(Pb.Survey);
const survey = {
  [s.name]: 'Survey name',
  [s.description]: 'Description something something',
  ...
};

@gino-m gino-m marked this pull request as ready for review August 1, 2024 19:44
amysorto
amysorto previously approved these changes Aug 1, 2024
amysorto
amysorto previously approved these changes Aug 1, 2024
@gino-m
Copy link
Collaborator Author

gino-m commented Aug 1, 2024

@rfontanarosa I still can't get this to work. For some reason when adding a new import of GroundProtos or registry, GroundProtos gets replaced with an invalid representation containing the following:

{
  "google": {
    "protobuf": {
      "NullValue": {
        "NULL_VALUE": 0
      }
    },
    "events": {
      "cloud": {
        "firestore": {
          "v1": {}
        }
      }
    },
    "type": {}
  }
}

None of these fields are in the ground-protos.js or ground-protos.d.ts, so I suspect either something is overriding the google namespace in that module.

@gino-m
Copy link
Collaborator Author

gino-m commented Aug 2, 2024

@rfontanarosa It seems there was a collision with google.* protos. Renaming proto packages to ground.* to fix. @shobhitagarwal1612 @sufyanAbbasi @scolsen A fix will also be needed on Android when we upgrade the proto dep, but the protos should be wire compatible even without.

@rfontanarosa rfontanarosa merged commit fbacf5c into master Aug 2, 2024
7 checks passed
@rfontanarosa rfontanarosa deleted the gino-m/patch/field-id-util branch August 2, 2024 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants