-
Notifications
You must be signed in to change notification settings - Fork 1.6k
no way to access data for unrecognized extensions #385
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
Comments
@dsnet any updates on how/when this issue might be resolved? |
I'll take a look. With Go1.9 out the door, I'm swinging my attention back over to protos. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Uh oh!
There was an error while loading. Please reload this page.
Access to extensions is provided by top-level functions in the
proto
package (inextensions.go
). But they omit any way to query for the values of unrecognized extensions (as raw unparsed bytes).My immediate use case is to be able to re-parse custom method options on a descriptor proto using a dynamic extension registry (not limited to just linked-in extensions). This allows a "server browser" tool to show more useful information about a server's exposed services instead of just "unknown fields/extensions". Using the server reflection API, the client can easily ask the server for all known extensions and then re-parse the descriptors (for example, using a dynamic message).
For symmetry with how C++ and Java libraries support extension and unknown fields, it would be preferred for unrecognized extensions to end up in
XXX_unrecognized
instead of hidden inside of a map of unparsed extension values that is inaccessible. (It used to be accessible via theExtensionMap()
method, but that is no longer generated by protoc-gen-go.)I also brought this up on the protobuf mailing list, where I think @xfxyjwf expressed a similar sentiment:
https://groups.google.com/d/topic/protobuf/HTNFwKLxtRg/discussion
I believe this could be addressed by merely changing the unmarshalling code to append the data to
XXX_unrecognized
instead of storing in the map when the looked up*ExtensionDesc
is nil.The text was updated successfully, but these errors were encountered: