Skip to content

Commit

Permalink
Add example where generated proto does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvanloon authored and achew22 committed Dec 16, 2019
1 parent 3c06998 commit 3141a31
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/proto/examplepb/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -13,12 +13,20 @@ package(default_visibility = ["//visibility:public"])
# gazelle:exclude wrappers.pb.gw.go
# gazelle:exclude response_body_service.pb.gw.go

genrule(
name = "generated_proto",
srcs = ["generated_input.proto"],
outs = ["generated_output.proto"],
cmd = "cp $< $@", # A simple copy simulates a generated proto file.
)

proto_library(
name = "examplepb_proto",
srcs = [
"a_bit_of_everything.proto",
"echo_service.proto",
"flow_combination.proto",
"generated_output.proto",
"non_standard_names.proto",
"response_body_service.proto",
"stream.proto",
21 changes: 21 additions & 0 deletions examples/proto/examplepb/generated_input.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";
option go_package = "examplepb";
package grpc.gateway.examples.examplepb;

import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "examples/proto/examplepb/a_bit_of_everything.proto";
import "examples/proto/sub/message.proto";

// This file is run through a genrule.

// Defines some more operations to be added to ABitOfEverythingService
service GeneratedService {
rpc Create(ABitOfEverything) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1/example/a_bit_of_everything/generated_create"
body: "*"
};
}

}

0 comments on commit 3141a31

Please sign in to comment.