Skip to content

Commit

Permalink
runtime: rewrite fieldmask logic with protoreflect
Browse files Browse the repository at this point in the history
Replace the use of the descriptorpb when we can use reflection
instead. Also add more thorough test and support repeated fields.
  • Loading branch information
johanbrandhorst committed May 14, 2020
1 parent 43ced79 commit 03d85a3
Show file tree
Hide file tree
Showing 29 changed files with 1,764 additions and 677 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ HELLOWORLD_GWSRCS=$(HELLOWORLD:.proto=.pb.gw.go)

RUNTIME_TEST_PROTO=runtime/internal/examplepb/example.proto \
runtime/internal/examplepb/proto2.proto \
runtime/internal/examplepb/proto3.proto
runtime/internal/examplepb/proto3.proto \
runtime/internal/examplepb/non_standard_names.proto
RUNTIME_TEST_SRCS=$(RUNTIME_TEST_PROTO:.proto=.pb.go)

EXAMPLE_CLIENT_DIR=examples/internal/clients
Expand Down
1 change: 0 additions & 1 deletion examples/internal/helloworld/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ go_library(
deps = [
"//internal/utilities:go_default_library",
"//runtime:go_default_library",
"@com_github_golang_protobuf//descriptor:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
Expand Down
2 changes: 0 additions & 2 deletions examples/internal/helloworld/helloworld.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions examples/internal/integration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go_test(
name = "go_default_test",
srcs = [
"client_test.go",
"fieldmask_test.go",
"integration_test.go",
"main_test.go",
],
Expand All @@ -19,7 +18,6 @@ go_test(
"//examples/internal/server:go_default_library",
"//runtime:go_default_library",
"@com_github_golang_glog//:go_default_library",
"@com_github_golang_protobuf//descriptor:go_default_library_gen",
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@com_github_google_go_cmp//cmp:go_default_library",
Expand Down
183 changes: 0 additions & 183 deletions examples/internal/integration/fieldmask_test.go

This file was deleted.

11 changes: 8 additions & 3 deletions examples/internal/proto/examplepb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ proto_library(
"echo_service.proto",
"flow_combination.proto",
"generated_output.proto",
"non_standard_names.proto",
"response_body_service.proto",
"stream.proto",
"unannotated_echo_service.proto",
Expand Down Expand Up @@ -74,18 +73,24 @@ go_proto_library(

go_library(
name = "go_default_library",
srcs = ["unannotated_echo_service.pb.gw.go"],
srcs = [
"non_standard_names.pb.go",
"unannotated_echo_service.pb.gw.go",
],
embed = [":examplepb_go_proto"],
importpath = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb",
deps = [
"//internal/utilities:go_default_library",
"//runtime:go_default_library",
"@com_github_golang_protobuf//descriptor:go_default_library_gen",
"@com_github_golang_protobuf//proto:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@io_bazel_rules_go//proto/wkt:field_mask_go_proto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
],
)

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions examples/internal/proto/examplepb/echo_service.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions examples/internal/proto/examplepb/flow_combination.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 03d85a3

Please sign in to comment.