-
Notifications
You must be signed in to change notification settings - Fork 326
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
Protobuf APIV2 #304
Merged
Merged
Protobuf APIV2 #304
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… the test folders to try out
…larly with all the go_package definitions in all the examples
…versions of protoc-gen-go and the new options that are needed
…hey generate code on the proper destination. Cleanup make file and keep removing test python files that are unused.
…olang.org/protobuf, both in generator and generated code. Fix tests. Fix parameter reading.
3ventic
reviewed
Apr 18, 2021
3ventic
approved these changes
Apr 23, 2021
This was referenced Apr 27, 2021
Merged
This PR will be released on May 3rd (next Monday) as |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #222, #301
Related: #299, #280, #275
Description
The protobuf library has updated from APIV1
github.com/golang/protobuf
to APIV2google.golang.org/protobuf
. Now Twirp generates code using the new types.Changes:
github.com/golang/protobuf/jsonpb
, it now usesgoogle.golang.org/protobuf/protojson
github.com/golang/protobuf/proto
, it now usesgoogle.golang.org/protobuf/proto
protoc-gen-twirp
) works with the latest version ofgoogle.golang.org/protobuf
protoc-gen-twirp
) improved usage of command line flags. It now acceptspaths=import
(default),paths=source_relative
,module={PREFIX}
and works well with multiple--proto_path
sources. This makes it fully compatible with the flags used onprotoc-gen-go
compiler invocation: https://developers.google.com/protocol-buffers/docs/reference/go-generated#invocationgo_package
on test proto files to use a fully qualified go import path. This is required by new versions ofprotoc-gen-go
.Update instructions
github.com/twitchtv/twirp
does not have any changes.github.com/twitchtv/twirp/protoc-gen-twirp
) will update their imports fromgithub.com/golang/protobuf/proto
(APIV1) togoogle.golang.org/protobuf
(APIV2). Projects that make use of the generated clients or service have to update the imports as well.google.golang.org/protobuf
(APIV2) is mostly backwards compatible, but not completely. Some changes that we found needed in our own tests:option go_package
is mandatory and must include a "/" (it is supposed to be a full import path). If you have to add a full path to the go_package, you may want to generate with the optionspaths=source_relative
. For example:protoc --go_out=. --go_opt=paths=source_relative --twirp_out=. --twirp_opt=paths=source_relative myfile.proto
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.