Comments (9)
I'm guessing this issue might apply to all other option types (MethodOptions, FieldOptions, etc.) as well then?
Yep. I'm looking at fixing it now: there are some tricks to interacting with options -- mainly if a descriptor has custom options that are not compiled into the Go program, in which case an extension registry is required. I think that will require some new API, to set an extension registry on a builder (or perhaps to supply one during the call to Build
).
from protoreflect.
@noahdietz, I just created a 1.2.0 release. There were numerous other fixes and additions on master since 1.1.0, so it seemed about time to go ahead and cut a new version.
from protoreflect.
I could be totally misunderstanding things, but I changed the protoprint tests to have the same custom option injected into the Service (if one was present) using the same code above (proto.SetExtension
on the reference provided by GetServiceOptions()
if present). I assumed the test actual output would differ from the golden as a result and fail the tests. This did not happen. Granted, this is a slightly different scenario, using a parsed protoset (tests) rather than one built via the builder pkg (my code). Lmk if I'm off-base or doing something wrong here. Thanks
EDIT: forgot to mention that when I included the aforementioned fix (including dm.GetKnownExtensions
), the tests failed in the way I expected, the custom option was included in the test actual output.
from protoreflect.
@noahdietz, the problem is actually in the desc/builder
package: when you build a descriptor for the service, it is failing to add that option's file to the imports of the service's enclosing file. So, since the file does not import that option, the printer has no knowledge of it.
from protoreflect.
Ah ok thanks @jhump for looking into and clarifying the issue. I'm guessing this issue might apply to all other option types (MethodOptions, FieldOptions, etc.) as well then?
from protoreflect.
@noahdietz, if you are able to give this a whirl, fetch latest and checkout the branch named
jh/builders-should-add-deps-for-options.
I think that will fix the issue you are encountering. In the meantime, I need to write some add'l test cases for this.
from protoreflect.
Worked like a charm!
Really appreciate the quick turn around.
from protoreflect.
@jhump out of curiosity, do you plan on making a release soon? I'm pinned to 1.1.0 currently, just wondering what to expect. Thanks
from protoreflect.
Thank you! Much appreciated
from protoreflect.
Related Issues (20)
- Protoreflect doesn't fall back to to v1alpha when a gRPC unimplemented response is returned HOT 1
- String escaping in protoprint is wrong HOT 1
- First enum value must be 0 in proto3 [protoprint] HOT 2
- missing `{}` after printing option HOT 5
- Upgrade protocompile to v0.7.0 HOT 3
- go build error HOT 3
- Regression upgrading from v1.14.1 to v1.15.4: extensions are resolved recursively instead of non-recursively HOT 1
- Regression upgrading from v1.14.1 to v1.15.4: absolute paths no longer accepted by parser.ParseFilesButDoNotLink HOT 3
- Regression upgrading from v1.14.1 to v1.15.4: new mustBeSource constraint/check HOT 5
- Stub structure and Methods will relay on protobuf API V2 HOT 15
- Fail to compile proto file HOT 2
- Tests broken with google.golang.org/protobuf v1.33.0
- If there are messages nested in the proto file, the numbers will be recognised as strings HOT 2
- invalid memory address or nil pointer dereference HOT 5
- will return Symbol not found when the proto file has enum definition HOT 1
- Is there a way to UseProtoNames? HOT 2
- desc/builder: feature request: auto-de-duplicate builders and already-built descriptors in transitive graph HOT 4
- NPE from sourceinfo wrapping logic
- Optional fields are considered oneofs? HOT 2
- ParseFilesButDoNotLink panics in option validation with invalid .proto HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protoreflect.