From ac8f96b8517030509b4129a46b47e882b35ce544 Mon Sep 17 00:00:00 2001 From: Elliot Jackson <13633636+ElliotMJackson@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:42:12 -0400 Subject: [PATCH 1/7] checkpoint --- Makefile | 2 +- go.mod | 2 +- go.sum | 4 ++-- legacy/translate_test.go | 25 +++++++++++++++++++------ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 20c3c43..8dfb25e 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ lint-proto: $(BIN)/buf .PHONY: conformance conformance: $(BIN)/protovalidate-conformance ## Run conformance tests $(GO) build -o $(BIN)/protovalidate-conformance-go ./internal/cmd/protovalidate-conformance-go - $(BIN)/protovalidate-conformance --strict --strict_message --strict_error $(ARGS) $(BIN)/protovalidate-conformance-go + $(BIN)/protovalidate-conformance $(ARGS) $(BIN)/protovalidate-conformance-go .PHONY: generate generate: generate-proto generate-license ## Regenerate code and license headers diff --git a/go.mod b/go.mod index ee318e5..8410c52 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bufbuild/protovalidate-go go 1.18 require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230711201221-890d7e3584ce.1 + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1 github.com/envoyproxy/protoc-gen-validate v1.0.2 github.com/google/cel-go v0.16.0 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 9c495dd..069f73c 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230711201221-890d7e3584ce.1 h1:LtMTVxNFGQ/AkswvA3AQgSMBjZw9bvu642Mww5rn5Tg= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230711201221-890d7e3584ce.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1 h1:EtAkUNUwgv7Omwyy11tQhLS0iJMOSGa2Tpp5acvydNk= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 h1:goHVqTbFX3AIo0tzGr14pgfAW2ZfPChKO21Z9MGf/gk= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/legacy/translate_test.go b/legacy/translate_test.go index f6e0946..9d3b5ea 100644 --- a/legacy/translate_test.go +++ b/legacy/translate_test.go @@ -105,7 +105,8 @@ func TestTranslateFieldOptions(t *testing.T) { msg: &examplev1.LegacySimple{}, field: "x", ex: &validate.FieldConstraints{Type: &validate.FieldConstraints_Int32{ - Int32: &validate.Int32Rules{Gt: proto.Int32(0)}, + Int32: &validate.Int32Rules{ + GreaterThan: &validate.Int32Rules_Gt{Gt: 0}}, }}, }, { @@ -135,7 +136,11 @@ func TestTranslateFieldOptions(t *testing.T) { ex: &validate.FieldConstraints{Type: &validate.FieldConstraints_Repeated{ Repeated: &validate.RepeatedRules{Items: &validate.FieldConstraints{ Type: &validate.FieldConstraints_Int32{ - Int32: &validate.Int32Rules{Gt: proto.Int32(0)}, + Int32: &validate.Int32Rules{ + GreaterThan: &validate.Int32Rules_Gt{ + Gt: 0, + }, + }, }, }}, }}, @@ -149,7 +154,11 @@ func TestTranslateFieldOptions(t *testing.T) { String_: &validate.StringRules{MinLen: proto.Uint64(3)}, }}, Values: &validate.FieldConstraints{Type: &validate.FieldConstraints_Int32{ - Int32: &validate.Int32Rules{Gt: proto.Int32(0)}, + Int32: &validate.Int32Rules{ + GreaterThan: &validate.Int32Rules_Gt{ + Gt: 0, + }, + }, }}, }, }}, @@ -192,9 +201,13 @@ func TestTranslateFieldOptions(t *testing.T) { field: "x", ex: &validate.FieldConstraints{ IgnoreEmpty: true, - Type: &validate.FieldConstraints_Int32{Int32: &validate.Int32Rules{ - Gt: proto.Int32(123), - }}, + Type: &validate.FieldConstraints_Int32{ + Int32: &validate.Int32Rules{ + GreaterThan: &validate.Int32Rules_Gt{ + Gt: 123, + }, + }, + }, }, }, } From 20d18a1864ecee5eae30ee4aaa343ec3b98eb826 Mon Sep 17 00:00:00 2001 From: Elliot Jackson <13633636+ElliotMJackson@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:07:01 -0400 Subject: [PATCH 2/7] checkpoint --- Makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 851a0b0..8e1028b 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ COPYRIGHT_YEARS := 2023 LICENSE_IGNORE := -e internal/testdata/ # Set to use a different compiler. For example, `GO=go1.18rc1 make test`. GO ?= go -ARGS ?= +ARGS ?= --strict --strict_message --strict_error # Set to use a different version of protovalidate-conformance. # Should be kept in sync with the version referenced in proto/buf.lock and # 'buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go' in go.mod. @@ -45,10 +45,7 @@ lint-proto: $(BIN)/buf $(BIN)/buf lint .PHONY: conformance -conformance: ## Run conformance tests - GOBIN=$(abspath $(BIN)) $(GO) install \ - github.com/bufbuild/protovalidate/tools/protovalidate-conformance@$(CONFORMANCE_VERSION) - $(GO) build -o $(BIN)/protovalidate-conformance-go ./internal/cmd/protovalidate-conformance-go +conformance: $(BIN)/protovalidate-conformance $(BIN)/protovalidate-conformance-go ## Run conformance tests $(BIN)/protovalidate-conformance $(ARGS) $(BIN)/protovalidate-conformance-go .PHONY: generate @@ -98,3 +95,11 @@ $(BIN)/license-header: $(BIN) Makefile $(BIN)/golangci-lint: $(BIN) Makefile GOBIN=$(abspath $(@D)) $(GO) install \ github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 + +$(BIN)/protovalidate-conformance: $(BIN) Makefile + GOBIN=$(abspath $(BIN)) $(GO) install \ + github.com/bufbuild/protovalidate/tools/protovalidate-conformance@$(CONFORMANCE_VERSION) + +$(BIN)/protovalidate-conformance-go: $(BIN) Makefile + GOBIN=$(abspath $(BIN)) $(GO) build -o $(BIN)/protovalidate-conformance-go \ + ./internal/cmd/protovalidate-conformance-go From 722bab0ac8f04f0afb11938bc4bc54b42dfd65be Mon Sep 17 00:00:00 2001 From: Elliot Jackson <13633636+ElliotMJackson@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:09:08 -0400 Subject: [PATCH 3/7] checkpoint --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8e1028b..5fc06e7 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ARGS ?= --strict --strict_message --strict_error # Set to use a different version of protovalidate-conformance. # Should be kept in sync with the version referenced in proto/buf.lock and # 'buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go' in go.mod. -CONFORMANCE_VERSION ?= v0.2.6 +CONFORMANCE_VERSION ?= 94e6fae .PHONY: help help: ## Describe useful make targets From f3c41d759d5b367aeb5504477fced460511f6919 Mon Sep 17 00:00:00 2001 From: Elliot Jackson <13633636+ElliotMJackson@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:00:06 -0400 Subject: [PATCH 4/7] checkpoint --- Makefile | 2 +- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5fc06e7..4b6bd50 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ARGS ?= --strict --strict_message --strict_error # Set to use a different version of protovalidate-conformance. # Should be kept in sync with the version referenced in proto/buf.lock and # 'buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go' in go.mod. -CONFORMANCE_VERSION ?= 94e6fae +CONFORMANCE_VERSION ?= v0.3.1 .PHONY: help help: ## Describe useful make targets diff --git a/go.mod b/go.mod index 8410c52..fba79b7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bufbuild/protovalidate-go go 1.18 require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1 + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822184709-ff921ee11715.1 github.com/envoyproxy/protoc-gen-validate v1.0.2 github.com/google/cel-go v0.16.0 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 069f73c..98858f8 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1 h1:EtAkUNUwgv7Omwyy11tQhLS0iJMOSGa2Tpp5acvydNk= buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822184709-ff921ee11715.1 h1:r2G+piWhGMS0eEvh//C6qtGDTkQCzafOquDWDve4wuE= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822184709-ff921ee11715.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 h1:goHVqTbFX3AIo0tzGr14pgfAW2ZfPChKO21Z9MGf/gk= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= From 1a4fcf5417278c11bedb2c29d004ae6103269fc2 Mon Sep 17 00:00:00 2001 From: Elliot Jackson <13633636+ElliotMJackson@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:01:14 -0400 Subject: [PATCH 5/7] checkpoint --- proto/buf.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/proto/buf.lock b/proto/buf.lock index 317a904..7b8d086 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -4,15 +4,15 @@ deps: - remote: buf.build owner: bufbuild repository: protovalidate - commit: f9bf3460ccf141d68ba17653f5ef85dc - digest: shake256:d763cdb6df6ec05e0859db78e0645a43603d06f0263d4dce59077de8c04c788b3e949c9a08f7769b296c2408d3039631f516cec0f43d0dbc052421c332700769 + commit: ff921ee117154e14b8de3b1335a0f257 + digest: shake256:a0069b0e821f75d5f1e2074a23856c1e63d5bfabb63286d37aaf64cc2f7854c41a8f0ed6c3cf6de1451e612ec1d1bde589b466c8d892f116905bfbb4e223e6c5 - remote: buf.build owner: bufbuild repository: protovalidate-testing - commit: 70b67aedfe1640df8b3fcdfa78933534 - digest: shake256:f230308f9c1c8a4192d65be08ec6c525e9fbc113a325bccf1decde22284a974ac0ffdb7354145116bd941ce96fbdad2c85091794df93076660765ece2d6713b3 + commit: 9ba6914764d140a2b9666e8b203e309f + digest: shake256:c23ce1466f562c828e181abc00ca47d7f1056bc05fe0048bc365dc4c9f9869d05ccb7688dac777957354083f5258219c242ea81716473c287b86b672580c138b - remote: buf.build owner: envoyproxy repository: protoc-gen-validate - commit: 6607b10f00ed4a3d98f906807131c44a - digest: shake256:acc7b2ededb2f88d296862943a003b157bdb68ec93ed13dcd8566b2d06e47993ea6daf12013b9655658aaf6bbdb141cf65bfe400ce2870f4654b0a5b45e57c09 + commit: eac44469a7af47e7839a7f1f3d7ac004 + digest: shake256:0feabcde01b6b11e3c75a5e3f807968d5995626546f39c37e5d4205892b3a59cced0ed83b35a2eb9e6dddd3309660ad46b737c9dcd224b425de0a6654ce04417 From ff5438f5ec0fdf7fc5a0ea4bef72db6f61026129 Mon Sep 17 00:00:00 2001 From: Elliot Jackson <13633636+ElliotMJackson@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:03:22 -0400 Subject: [PATCH 6/7] checkpoint --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index fba79b7..28275bb 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822184709-ff921ee11715.1 github.com/envoyproxy/protoc-gen-validate v1.0.2 - github.com/google/cel-go v0.16.0 + github.com/google/cel-go v0.17.1 github.com/stretchr/testify v1.8.4 google.golang.org/protobuf v1.31.0 ) diff --git a/go.sum b/go.sum index 98858f8..4eb18c6 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1 h1:EtAkUNUwgv7Omwyy11tQhLS0iJMOSGa2Tpp5acvydNk= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822142711-e7ffd27c11fc.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew= buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822184709-ff921ee11715.1 h1:r2G+piWhGMS0eEvh//C6qtGDTkQCzafOquDWDve4wuE= buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230822184709-ff921ee11715.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 h1:goHVqTbFX3AIo0tzGr14pgfAW2ZfPChKO21Z9MGf/gk= @@ -11,8 +9,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/cel-go v0.16.0 h1:DG9YQ8nFCFXAs/FDDwBxmL1tpKNrdlGUM9U3537bX/Y= -github.com/google/cel-go v0.16.0/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= +github.com/google/cel-go v0.17.1 h1:s2151PDGy/eqpCI80/8dl4VL3xTkqI/YubXLXCFw0mw= +github.com/google/cel-go v0.17.1/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= From dea2d4f1d5abcc397816b23507310dd37e74b3a8 Mon Sep 17 00:00:00 2001 From: Elliot Jackson <13633636+ElliotMJackson@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:57:54 -0400 Subject: [PATCH 7/7] checkpoint --- .../gen/buf/validate/conformance/cases/wkt_timestamp.pb.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/gen/buf/validate/conformance/cases/wkt_timestamp.pb.go b/internal/gen/buf/validate/conformance/cases/wkt_timestamp.pb.go index 6104100..982c34b 100644 --- a/internal/gen/buf/validate/conformance/cases/wkt_timestamp.pb.go +++ b/internal/gen/buf/validate/conformance/cases/wkt_timestamp.pb.go @@ -870,13 +870,13 @@ var file_buf_validate_conformance_cases_wkt_timestamp_proto_rawDesc = []byte{ 0x4c, 0x54, 0x4e, 0x6f, 0x77, 0x57, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xba, 0x48, 0x0a, 0xb2, 0x01, 0x07, 0x38, 0x01, 0x4a, 0x03, - 0x08, 0x90, 0x1c, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x53, 0x0a, 0x14, 0x54, 0x69, 0x6d, 0x65, + 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xba, 0x48, 0x0a, 0xb2, 0x01, 0x07, 0x4a, 0x03, 0x08, 0x90, + 0x1c, 0x38, 0x01, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x53, 0x0a, 0x14, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x47, 0x54, 0x4e, 0x6f, 0x77, 0x57, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xba, 0x48, 0x0a, 0xb2, 0x01, - 0x07, 0x40, 0x01, 0x4a, 0x03, 0x08, 0x90, 0x1c, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x42, 0xa5, 0x02, + 0x07, 0x4a, 0x03, 0x08, 0x90, 0x1c, 0x40, 0x01, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x42, 0xa5, 0x02, 0x0a, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x63, 0x61, 0x73, 0x65, 0x73, 0x42, 0x11, 0x57, 0x6b, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,