-
Notifications
You must be signed in to change notification settings - Fork 172
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
desc.Descriptor wraps protoreflect.Descriptor #354
Conversation
54c33ef
to
5bcf388
Compare
I've found this library really useful so far, but would love to be able to use it with the newer APIs (e.g. |
@timruffles, sorry for the very late reply. I was taking a sabbatical for several months, including in April when you wrote this. My plan is to focus more on https://github.com/jhump/protocompile, a new API for parsing/compiling protos that directly uses the new API v2 libraries. Once that is done and I've got it integrated into https://github.com/bufbuild/buf (replacing the use of |
3d9bc9e
to
321bedd
Compare
321bedd
to
69e5681
Compare
I still need to run I don't want this to be a v2 of these packages: for a v2, I plan to intentionally break backwards-compatibility and even remove stuff in here that now overlaps with the v2 API of the protobuf runtime ( |
- canonicalized imports to use google.golang.org/protobuf/types - some other minor changes related to using no protobuf runtime - most other packages still need updates - adds new entry points to desc/sourceinfo so the new wrapped descriptor caching works correctly and still returns source code info if available
… in tests; canonicalized imports)
…ge sets; extra work in converting an API v2 message with extensions) - updates to sourceinfo: can't unconditionally wrap or else things fall done in desc with wrapper caches
… tests to accomoodate
… purego tests (and had to fix internal/codec/encoding_test)
63c5ae0
to
efacbda
Compare
I've finally confirmed with
Despite the significant overhauling of So I will be merging this and awaiting input from folks to see if there is any fall-out. I suspect there will be some performance impact and that the |
This is a major overhaul that enables full interop with the protoreflect package in the newer Go protobuf API. It makes it easy to convert between
desc.Descriptor
types andprotoreflect.Descriptor
types.It was also necessary to make significant changes to
protoparse
, because it would builddesc.Descriptor
instances during linking, that were intermediate artifacts. But that can't work now thatdesc.Descriptor
is a wrapper aroundprotoreflect.Descriptor
because the functions to create theprotoreflect.Descriptor
instances do more validation that cannot succeed at this phase of linking (because options have not yet been interpreted). I had already solved this by creating unexported implementations of the variousprotoreflect.Descriptor
interfaces, that wrap descriptor protos and linker state. This means that interpreting options usesdynamicpb
instead of thedynamic
package in this repo. All of that is actually implemented inprotoparse
's successor: http://github.com/bufbuild/protocompile. Soprotoparse
in this repo, as of this PR, now wrapsprotocompile
. 🤯While fixing some strange issues in the
protoprint
package that occurred after theprotoparse
overhaul, I ended up re-writing how it handles rendering custom options and message literals. It no longer uses theproto
package's text marshaling functionality but instead has its own custom test marshaling (which also allows it to address how to render qualified names in extensions in message literals and also provides much greater control over formatting and where to putline breaks, allowing the output to be both readable and more compact).
Resolves #301, #444, and #531.