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

Obtain valid values and keys for enum #47

Closed
fabioMarocchi opened this issue Feb 28, 2019 · 1 comment
Closed

Obtain valid values and keys for enum #47

fabioMarocchi opened this issue Feb 28, 2019 · 1 comment

Comments

@fabioMarocchi
Copy link

Assuming I have the following .proto file

message Foo {
  Bar bar = 1;
}
enum Bar {
  a = 0;
  b = 1;
}

Is there a way to obtain all the valid enum values/keys?

I know that I can switch between atom and integer with Bar.value(:a) and Bar.key(0), but I couldn't find a way to obtain something like Bar.keys() to obtain [:a, :b], Bar.values() to obtain [0, 1] or Bar.map() to obtain %{a: 0, b: 1}

My apologies if there's already a function implemented and I didn't find it. If there isn't, I think it could be helpful.

@fabioMarocchi
Copy link
Author

This functionality was added in 8c86518 so I'm marking this issue as closed.

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

No branches or pull requests

1 participant