Skip to content

feat: add Opaque API and Protobuf Editions support #5723

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ proto:
--template ./protoc-gen-openapiv2/options/buf.gen.yaml \
--path ./protoc-gen-openapiv2/options/annotations.proto \
--path ./protoc-gen-openapiv2/options/openapiv2.proto
buf generate \
--template ./examples/internal/proto/examplepb/opaque.buf.gen.yaml \
--path examples/internal/proto/examplepb/opaque.proto

generate: proto $(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) $(UNANNOTATED_ECHO_EXAMPLE_SRCS) $(RESPONSE_BODY_EXAMPLE_SRCS) $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ gRPC-Gateway, and a gRPC server, see
- Automatically translating PATCH requests into Field Mask gRPC requests. See
[the docs](https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/patch_feature/)
for more information.
- [Protobuf Editions](https://protobuf.dev/editions/overview/) support (edition 2023).
- Go [Opaque API](https://go.dev/blog/protobuf-opaque) support.

### No plan to support

Expand Down
4 changes: 4 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ lint:
- examples/internal/proto/examplepb/generated_input.proto
- examples/internal/proto/examplepb/excess_body.proto
- examples/internal/proto/examplepb/non_standard_names.proto
- examples/internal/proto/examplepb/opaque.proto
- examples/internal/proto/examplepb/openapi_merge_a.proto
- examples/internal/proto/examplepb/openapi_merge_b.proto
- examples/internal/proto/examplepb/response_body_service.proto
Expand Down Expand Up @@ -58,6 +59,7 @@ lint:
- examples/internal/proto/examplepb/generated_input.proto
- examples/internal/proto/examplepb/excess_body.proto
- examples/internal/proto/examplepb/non_standard_names.proto
- examples/internal/proto/examplepb/opaque.proto
- examples/internal/proto/examplepb/openapi_merge_a.proto
- examples/internal/proto/examplepb/openapi_merge_b.proto
- examples/internal/proto/examplepb/response_body_service.proto
Expand Down Expand Up @@ -89,6 +91,7 @@ lint:
- examples/internal/proto/examplepb/generated_input.proto
- examples/internal/proto/examplepb/excess_body.proto
- examples/internal/proto/examplepb/non_standard_names.proto
- examples/internal/proto/examplepb/opaque.proto
- examples/internal/proto/examplepb/response_body_service.proto
- examples/internal/proto/examplepb/stream.proto
- examples/internal/proto/examplepb/unannotated_echo_service.proto
Expand All @@ -111,6 +114,7 @@ lint:
- examples/internal/proto/examplepb/generated_input.proto
- examples/internal/proto/examplepb/excess_body.proto
- examples/internal/proto/examplepb/non_standard_names.proto
- examples/internal/proto/examplepb/opaque.proto
- examples/internal/proto/examplepb/openapi_merge_a.proto
- examples/internal/proto/examplepb/openapi_merge_b.proto
- examples/internal/proto/examplepb/response_body_service.proto
Expand Down
3 changes: 3 additions & 0 deletions examples/internal/proto/examplepb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ package(default_visibility = ["//visibility:public"])
# gazelle:exclude unannotated_echo_service_grpc.pb.go
# gazelle:exclude visibility_rule_echo_service.pb.gw.go
# gazelle:exclude visibility_rule_echo_service_grpc.pb.go
# gazelle:exclude opaque.pb.gw.go
# gazelle:exclude opaque_grpc.pb.go
# gazelle:exclude openapi_merge_a.proto
# gazelle:exclude openapi_merge_b.proto
# gazelle:go_grpc_compilers //:go_apiv2, //:go_grpc, //protoc-gen-grpc-gateway:go_gen_grpc_gateway
Expand All @@ -60,6 +62,7 @@ proto_library(
"generated_output.proto",
"ignore_comment.proto",
"non_standard_names.proto",
"opaque.proto",
"remove_internal_comment.proto",
"response_body_service.proto",
"stream.proto",
Expand Down
17 changes: 17 additions & 0 deletions examples/internal/proto/examplepb/opaque.buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: v2
plugins:
- remote: buf.build/protocolbuffers/go:v1.36.6
out: .
opt:
- paths=source_relative
- default_api_level=API_OPAQUE
- remote: buf.build/grpc/go:v1.5.1
out: .
opt:
- paths=source_relative
- require_unimplemented_servers=false
- local: protoc-gen-grpc-gateway
out: .
opt:
- paths=source_relative
- use_opaque_api=true
Loading
Loading