-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fixed extends #1202
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
base: master
Are you sure you want to change the base?
Fixed extends #1202
Conversation
Thanks for this fix @jroper! We had a little issue when this PR was submitted, and CI did not get a chance to run. Would you mind rebasing and pushing again to trigger Travis? Thank you! |
Extended fields were being named using the full name, which meant they always had a dot before them, eg: message A { extensions 1000 to max; } extends A { optional string extended = 1000; } would decode to: { ".extended": "value" } This fixes it, using the fields name, rather than the fields full name.
Actually, I'm now reconsidering whether this change is right... I'm not sure. I don't think it should be always prefixed with a dot, but should it always contain the namespace? Possibly? Maybe if the extension comes from another file (package)? I don't know. It gets even more complex when considering extensions for options fields in protobuf, eg:
When this actually gets used, it has to be fully qualified:
Maybe that's a different thing and should be treated differently. Not sure. Anyway, I've rebased as requested. |
Using the full name is actually intended btw, because extended field names are not unique. There might be multiple extensions using the same field name but differing ids. The official API solves this by getting extended field values via the extension, while we are solving it by using the full name. As such, this is not a fix but breaks it. |
@dcodeIO but should it be prepended with a |
The leading dot is mostly a mechanism to tell a resolve step to start at the root, so Edit, found it: https://developers.google.com/protocol-buffers/docs/proto#packages-and-name-resolution
|
We can try and clarify this with the protobuf team, but it looks to me that the current behavior is correct. |
Extended fields were being named using the full name, which meant they always had a dot before them, eg:
would decode to:
This fixes it, using the fields name, rather than the fields full name.