Skip to content

Commit

Permalink
Generate gateway files according to source-relative flag (#327)
Browse files Browse the repository at this point in the history
* generate gateway files according to source-relative flag

* restore paralleism
  • Loading branch information
ido-namely authored Aug 26, 2022
1 parent f6418ca commit 1225940
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion all/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ if [ $GEN_GATEWAY = true ]; then
mkdir -p ${GATEWAY_DIR}

protoc $PROTO_INCLUDE \
--grpc-gateway_out=logtostderr=true:$GATEWAY_DIR ${PROTO_FILES[@]} \
--grpc-gateway_out=${GO_SOURCE_RELATIVE}logtostderr=true:$GATEWAY_DIR ${PROTO_FILES[@]} \
--grpc-gateway_opt generate_unbound_methods=$GENERATE_UNBOUND_METHODS

if [[ $OPENAPI_JSON == true ]]; then
Expand Down
15 changes: 15 additions & 0 deletions all/test/all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,21 @@ func (s *TestSuite) TestAllCases() {
},
extraArgs: []string{"--with-gateway"},
},
"go with gateway and source_relative": {
lang: "go",
protofileName: "all/test/test.proto",
expectedOutputDir: "gen/pb-go",
fileExpectations: []FileExpectation{
{fileName: "all/test/test.pb.go"},
{fileName: "/all/test/test.pb.gw.go", assert: func(filePath, expectedValue string) {
fileText := s.readFile(filePath)
s.Assert().False(strings.Contains(fileText, expectedValue), "contains \"%s\"", expectedValue)
}, expectedValue: "UnboundUnary",
},
{fileName: "/all/test/test.swagger.json"},
},
extraArgs: []string{"--with-gateway", "--go-source-relative"},
},
"go with gateway and json": {
lang: "go",
protofileName: "all/test/test.proto",
Expand Down

0 comments on commit 1225940

Please sign in to comment.