-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from collectiveidea/introduce-generate-option
Introduce generate option to customize output
- Loading branch information
Showing
21 changed files
with
473 additions
and
112 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
syntax = "proto3"; | ||
|
||
// This is a contrived example that demonstrates: | ||
// | ||
// 1. Code generation for multiple services, each with multiple rpcs | ||
// 2. Using imported types for request and response types | ||
// 3. Services proto in a completely different package | ||
// | ||
// This file does _not_ demonstrate best practices. | ||
|
||
package api; | ||
|
||
import "common/rpc/status.proto"; | ||
import "common/type/color.proto"; | ||
import "common/type/time_of_day.proto"; | ||
|
||
service GreetService { | ||
rpc SayHello(HelloRequest) returns (HelloResponse); | ||
rpc SayGoodbye(GoodbyeRequest) returns (GoodbyeResponse); | ||
rpc ChangeColor(.common.type.Color) returns (ChangeColorResponse); | ||
} | ||
|
||
service StatusService { | ||
rpc GetStatus(StatusRequest) returns (.common.rpc.Status); | ||
rpc GetTimeOfDay(TimeOfDayRequest) returns (common.type.TimeOfDay); | ||
} | ||
|
||
message HelloRequest { | ||
string name = 1; | ||
} | ||
|
||
message HelloResponse { | ||
string response = 1; | ||
.common.type.Color favorite_color = 2; | ||
} | ||
|
||
message GoodbyeRequest { | ||
string name = 1; | ||
} | ||
|
||
message GoodbyeResponse { | ||
string response = 1; | ||
} | ||
|
||
message ChangeColorResponse {} | ||
|
||
message StatusRequest {} | ||
|
||
message TimeOfDayRequest {} |
Binary file not shown.
Binary file added
BIN
+12 KB
spec/fixtures/complex_example/api_code_gen_request_skip_empty_generate_both_pb.bin
Binary file not shown.
Binary file added
BIN
+12 KB
spec/fixtures/complex_example/api_code_gen_request_skip_empty_generate_client_pb.bin
Binary file not shown.
Binary file added
BIN
+12 KB
spec/fixtures/complex_example/api_code_gen_request_skip_empty_generate_service_pb.bin
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
syntax = "proto3"; | ||
|
||
package common.rpc; | ||
|
||
import "google/protobuf/any.proto"; | ||
|
||
message Status { | ||
int32 code = 1; | ||
string message = 2; | ||
repeated google.protobuf.Any details = 3; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
|
||
package common.type; | ||
|
||
message Color { | ||
float red = 1; | ||
float green = 2; | ||
float blue = 3; | ||
float alpha = 4; | ||
} |
13 changes: 13 additions & 0 deletions
13
spec/fixtures/complex_example/common/type/time_of_day.proto
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
syntax = "proto3"; | ||
|
||
package common.type; | ||
|
||
message TimeOfDay { | ||
enum Meridiem { | ||
UNKNOWN = 0; | ||
ANTE = 1; | ||
POST = 2; | ||
} | ||
|
||
Meridiem am_or_pm = 1; | ||
} |
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-1.28 KB
spec/fixtures/import_type_retention/example_code_gen_request_pb.bin
Binary file not shown.
Binary file removed
BIN
-1.29 KB
spec/fixtures/import_type_retention/example_code_gen_request_skip_empty_pb.bin
Binary file not shown.
9 changes: 0 additions & 9 deletions
9
spec/fixtures/import_type_retention/package/actions/asks.proto
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+1.03 KB
spec/fixtures/service_code_gen_request_generate_param_invalid_value_pb.bin
Binary file not shown.
Binary file added
BIN
+1.03 KB
spec/fixtures/service_code_gen_request_generate_param_missing_value_pb.bin
Binary file not shown.
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
Oops, something went wrong.