Skip to content

Commit

Permalink
solution for the issue: lyft/protoc-gen-star#64
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam010 committed Aug 5, 2020
1 parent e054e31 commit 542f3a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions check.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import "type.proto";

message Check {
string field_1 = 1 [(main.rule1).type.one = "rule1.type.one", (main.rule1).type.two = "rule1.type.two"];
// issue
string field_2 = 2 [(main.rule2).type.one = "rule2.type.one", (main.rule2).type.two = "rule2.type.two"];
string field_3 = 3 [(main.rule2).type.two = "rule2.type.two", (main.rule2).type.one = "rule2.type.one"];
// solution
string field_4 = 4 [(main.rule2).type = {one: "rule2.type.one" two: "rule2.type.two"}];
string field_5 = 5 [(main.rule2).type = {two: "rule2.type.two" one: "rule2.type.one"}];
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
pgs "github.com/lyft/protoc-gen-star"
)

//TODO: GO111MODULE=on go build -o bin/protoc-gen-sample
//go:generate go build -o bin/protoc-gen-sample
//go:generate protoc -I . type.proto --go_out=plugins=grpc:.
//go:generate protoc -I . check.proto --plugin=bin/protoc-gen-sample --sample_out=:.

Expand Down
2 changes: 2 additions & 0 deletions sample.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
field_1 one:"rule1.type.one" two:"rule1.type.two"
field_2 two:"rule2.type.two"
field_3 one:"rule2.type.one"
field_4 one:"rule2.type.one" two:"rule2.type.two"
field_5 one:"rule2.type.one" two:"rule2.type.two"

0 comments on commit 542f3a1

Please sign in to comment.