diff --git a/Makefile b/Makefile index fe5e03b..4b6bd50 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,11 @@ 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. -CONFORMANCE_VERSION ?= v0.2.6 +CONFORMANCE_VERSION ?= v0.3.1 .PHONY: help help: ## Describe useful make targets @@ -45,11 +45,8 @@ 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 - $(BIN)/protovalidate-conformance --strict --strict_message --strict_error $(ARGS) $(BIN)/protovalidate-conformance-go +conformance: $(BIN)/protovalidate-conformance $(BIN)/protovalidate-conformance-go ## Run conformance tests + $(BIN)/protovalidate-conformance $(ARGS) $(BIN)/protovalidate-conformance-go .PHONY: generate generate: generate-proto generate-license ## Regenerate code and license headers @@ -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 diff --git a/go.mod b/go.mod index 42b8b5a..28275bb 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-20230802163732-1c33ebd9ecfa.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.17.1 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 959ff4f..4eb18c6 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230802163732-1c33ebd9ecfa.1 h1:tdpHgTbmbvEIARu+bixzmleMi14+3imnpoFXz+Qzjp4= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230802163732-1c33ebd9ecfa.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= 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, 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, + }, + }, + }, }, }, } 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