Skip to content

Commit

Permalink
Merge pull request #26 from TheThingsIndustries/fix/repeated
Browse files Browse the repository at this point in the history
Fix handling of repeated fields in validators
  • Loading branch information
rvolosatovs authored Feb 28, 2019
2 parents cbc52bc + 95d6127 commit 08c4649
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 48 deletions.
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/TheThingsIndustries/protoc-gen-star v0.4.7-gogo h1:vtoerBb3MHbzeUM0+w/bBpIhzT+yCaD1QrDN1/p7F2A=
github.com/TheThingsIndustries/protoc-gen-star v0.4.7-gogo/go.mod h1:lIqzPBz4CG/TSsK9fPQvo7iVfbxEWc+76AVxeiHMcT4=
github.com/TheThingsIndustries/protoc-gen-validate v0.0.13-fieldmask h1:vIdGpbSKd0SJJoC+BEZc/17W+N3CKh6qjfpXKbyCw7g=
github.com/TheThingsIndustries/protoc-gen-validate v0.0.13-fieldmask h1:ceerwKg0M/jOU1sdjzHx3k+KsFIZ2LyrNNT+EVXW/AI=
github.com/TheThingsIndustries/protoc-gen-validate v0.0.13-fieldmask/go.mod h1:65OEzdQPsbLDokGIF3GQjCTWOuuVuHqxh7a08yYe0tw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
5 changes: 5 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func TestFieldMaskPaths(t *testing.T) {
"a.d",
"a.e",
"a.f",
"a.g",
"b",
"b.a",
"b.a.a",
Expand All @@ -173,6 +174,7 @@ func TestFieldMaskPaths(t *testing.T) {
"b.d",
"b.e",
"b.f",
"b.g",
"c",
"c.a",
"c.a.a",
Expand All @@ -192,6 +194,7 @@ func TestFieldMaskPaths(t *testing.T) {
"c.d",
"c.e",
"c.f",
"c.g",
"g",
"h",
"i",
Expand Down Expand Up @@ -229,6 +232,7 @@ func TestFieldMaskPaths(t *testing.T) {
"d",
"e",
"f",
"g",
})
a.So(testdata.Test_TestNestedFieldPathsTopLevel, should.Resemble, []string{
"a",
Expand All @@ -237,6 +241,7 @@ func TestFieldMaskPaths(t *testing.T) {
"d",
"e",
"f",
"g",
})

a.So(testdata.Test_TestNested_TestNestedNestedFieldPathsNested, should.Resemble, []string{
Expand Down
102 changes: 55 additions & 47 deletions testdata/testdata.pb.go

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

5 changes: 5 additions & 0 deletions testdata/testdata.pb.paths.fm.go

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

9 changes: 9 additions & 0 deletions testdata/testdata.pb.setters.fm.go

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

17 changes: 17 additions & 0 deletions testdata/testdata.pb.validate.go

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

1 change: 1 addition & 0 deletions testdata/testdata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ message Test {
google.protobuf.Timestamp d = 4 [(gogoproto.stdtime) = true];
string e = 5 [(gogoproto.customtype) = "github.com/TheThingsIndustries/protoc-gen-fieldmask/testdata/testpackage.CustomType"];
string f = 6 [(gogoproto.customtype) = "github.com/TheThingsIndustries/protoc-gen-fieldmask/testdata/testpackage.CustomType", (gogoproto.nullable) = false];
repeated TestNestedNested g = 7;
}
TestNested a = 1;
TestNested b = 2 [(gogoproto.customname) = "CustomName"];
Expand Down

0 comments on commit 08c4649

Please sign in to comment.