Generated js client - How to read enums and access the full enum list? #1028
-
Hello everyone, I have a JavaScript client generated with connect-es. In 'car_pb.js': export const Car = proto3.makeMessageType(
() => [
{ no: 1, name: "type", kind: "enum", T: proto3.getEnumType(Car_Type) },
],
); export const Car_Type = proto3.makeEnum(
[
{no: 0, name: "TYPE_BLUE", localName: "BLUE"},
{no: 1, name: "TYPE_RED", localName: "RED"},
],
); When i get the data from the API I have only access to the enum Id or the lcal name (ex: "BLUE"). Also how can I get the full Car_Type definition from the generated client? Thank you very much and sorry if this is not clear. |
Beta Was this translation helpful? Give feedback.
Answered by
nicksnyder
Jan 22, 2025
Replies: 1 comment 1 reply
-
Hey! the docs for the protobuf types are here: https://github.com/bufbuild/protobuf-es/blob/main/docs/runtime_api.md#enumerations |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated link to documentation for enumerations: https://github.com/bufbuild/protobuf-es/blob/main/MANUAL.md#enumerations