-
Notifications
You must be signed in to change notification settings - Fork 62
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
findCustomEnumOption
always returns 1
#534
Comments
Hi, @jafaircl this is because the
This is why your second edit worked -- because it uses a message option as a wrapper. |
Ok, thanks. I missed that part of the docs. Any idea when the |
We've postponed this feature so far because of the issue that some users may not want their options shipped in a bundle, but with option retention in Protobuf v22.0 this becomes a bit easier. See this issue for more details. TL;DR - it is on our roadmap for sure. Unfortunately no official timeline quite yet though. |
@timostamm awesome. I see that you can get service and message extensions. Will we also be able to get field options? And will these values be available at runtime or only in plugins? |
Yes, you can get field options as well, they are just extensions to Options cannot be read at runtime yet. From the new docs:
Next up is better support for proto2 field presence. After that, embedding full descriptors in the generated code. The full descriptors will include options, which can then be read via extensions. So it'll be possible soonish - certainly this quarter. |
When using the
findCustomEnum
helper function in a plugin, the value returned is always1
. Specifically, I'm trying to set thegoogle.api.field_behavior
for a field like so:And my plugin code looks like:
The expected value for this option would be
5
. If the option isn't set, it returnsundefined
as expected.I can see in the test cases that you are testing to make sure the value is returned. But, it just so happens that the value in your test case is 1.
Maybe I'm just misunderstanding what should be returned from this function? I thought it should be the field number from the enum. Should it not? If that's incorrect, how can I get the proper value?
Thanks!
Edit: Here is a minimum reproduction: https://github.com/jafaircl/enum-repro
Edit 2: It also doesn't seem to be a problem when parsing an option that is a message which contains an enum field. The message field in that case has the correct value. So if I did:
That parses fine with
findCustomMessageOption
.The text was updated successfully, but these errors were encountered: