Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of repeated fields in validators #26

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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