From 56ee2828128cb94a7f5fd1bb99f07d0c361973e6 Mon Sep 17 00:00:00 2001 From: Chris Roche Date: Mon, 6 Nov 2023 09:29:12 -0800 Subject: [PATCH] Add conformance tests for ignore_empty (#126) Following #124, this adds conformance tests that ensure the `ignore_empty` rules is consistent with `required`. Mainly, if a field cannot differentiate between unset and the zero value (i.e., is not nullable), then this rule applies; effectively this is just repeated and map fields, as well as non-optional proto3 scalar outside of a oneof. Running against `protovalidate-go`, a few places where `ignore_empty` should be a noop ends up disabling evaluations. This will be a minor follow-up fix in that library. Patches for the other libraries will follow to bring them into conformance with these tests and those in #124. --- .../validate/conformance/cases/BUILD.bazel | 2 + .../cases/ignore_empty_proto2.proto | 78 ++ .../cases/ignore_empty_proto3.proto | 70 ++ .../cases/ignore_empty_proto2.pb.go | 673 ++++++++++++++++++ .../cases/ignore_empty_proto3.pb.go | 607 ++++++++++++++++ .../internal/cases/cases.go | 1 + .../internal/cases/cases_ignore_empty.go | 196 +++++ 7 files changed, 1627 insertions(+) create mode 100644 proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto2.proto create mode 100644 proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto3.proto create mode 100644 tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto2.pb.go create mode 100644 tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto3.pb.go create mode 100644 tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go diff --git a/proto/protovalidate-testing/buf/validate/conformance/cases/BUILD.bazel b/proto/protovalidate-testing/buf/validate/conformance/cases/BUILD.bazel index 0944415e..1cc09d6a 100644 --- a/proto/protovalidate-testing/buf/validate/conformance/cases/BUILD.bazel +++ b/proto/protovalidate-testing/buf/validate/conformance/cases/BUILD.bazel @@ -22,6 +22,8 @@ proto_library( "bytes.proto", "enums.proto", "filename-with-dash.proto", + "ignore_empty_proto2.proto", + "ignore_empty_proto3.proto", "kitchen_sink.proto", "maps.proto", "messages.proto", diff --git a/proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto2.proto b/proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto2.proto new file mode 100644 index 00000000..8e2a9fb2 --- /dev/null +++ b/proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto2.proto @@ -0,0 +1,78 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +package buf.validate.conformance.cases; + +import "buf/validate/validate.proto"; + +message IgnoreEmptyProto2ScalarOptional { + optional int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).int32.gt = 0 + ]; +} + +message IgnoreEmptyProto2ScalarOptionalWithDefault { + optional int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).int32.gt = 0, + default = 42 + ]; +} + +message IgnoreEmptyProto2ScalarRequired { + required int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).int32.gt = 0 + ]; +} + +message IgnoreEmptyProto2Message { + optional Msg val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).cel = { + id: "ignore_empty.proto2.message", + message: "foobar", + expression: "this.val == 'foo'", + } + ]; + message Msg { + optional string val = 1; + } +} + +message IgnoreEmptyProto2Oneof { + oneof o { + int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).int32.gt = 0 + ]; + } +} + +message IgnoreEmptyProto2Repeated { + repeated int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).repeated.min_items = 3 + ]; +} + +message IgnoreEmptyProto2Map { + map val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).map.min_pairs = 3 + ]; +} diff --git a/proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto3.proto b/proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto3.proto new file mode 100644 index 00000000..81b68475 --- /dev/null +++ b/proto/protovalidate-testing/buf/validate/conformance/cases/ignore_empty_proto3.proto @@ -0,0 +1,70 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package buf.validate.conformance.cases; + +import "buf/validate/validate.proto"; + +message IgnoreEmptyProto3Scalar { + int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).int32.gt = 0 + ]; +} + +message IgnoreEmptyProto3OptionalScalar { + optional int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).int32.gt = 0 + ]; +} + +message IgnoreEmptyProto3Message { + optional Msg val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).cel = { + id: "ignore_empty.proto3.message", + message: "foobar", + expression: "this.val == 'foo'", + } + ]; + message Msg { + string val = 1; + } +} + +message IgnoreEmptyProto3Oneof { + oneof o { + int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).int32.gt = 0 + ]; + } +} + +message IgnoreEmptyProto3Repeated { + repeated int32 val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).repeated.min_items = 3 + ]; +} + +message IgnoreEmptyProto3Map { + map val = 1 [ + (buf.validate.field).ignore_empty = true, + (buf.validate.field).map.min_pairs = 3 + ]; +} diff --git a/tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto2.pb.go b/tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto2.pb.go new file mode 100644 index 00000000..e58afab6 --- /dev/null +++ b/tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto2.pb.go @@ -0,0 +1,673 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: buf/validate/conformance/cases/ignore_empty_proto2.proto + +package cases + +import ( + _ "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IgnoreEmptyProto2ScalarOptional struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val *int32 `protobuf:"varint,1,opt,name=val" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto2ScalarOptional) Reset() { + *x = IgnoreEmptyProto2ScalarOptional{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2ScalarOptional) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2ScalarOptional) ProtoMessage() {} + +func (x *IgnoreEmptyProto2ScalarOptional) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2ScalarOptional.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2ScalarOptional) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{0} +} + +func (x *IgnoreEmptyProto2ScalarOptional) GetVal() int32 { + if x != nil && x.Val != nil { + return *x.Val + } + return 0 +} + +type IgnoreEmptyProto2ScalarOptionalWithDefault struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val *int32 `protobuf:"varint,1,opt,name=val,def=42" json:"val,omitempty"` +} + +// Default values for IgnoreEmptyProto2ScalarOptionalWithDefault fields. +const ( + Default_IgnoreEmptyProto2ScalarOptionalWithDefault_Val = int32(42) +) + +func (x *IgnoreEmptyProto2ScalarOptionalWithDefault) Reset() { + *x = IgnoreEmptyProto2ScalarOptionalWithDefault{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2ScalarOptionalWithDefault) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2ScalarOptionalWithDefault) ProtoMessage() {} + +func (x *IgnoreEmptyProto2ScalarOptionalWithDefault) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2ScalarOptionalWithDefault.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2ScalarOptionalWithDefault) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{1} +} + +func (x *IgnoreEmptyProto2ScalarOptionalWithDefault) GetVal() int32 { + if x != nil && x.Val != nil { + return *x.Val + } + return Default_IgnoreEmptyProto2ScalarOptionalWithDefault_Val +} + +type IgnoreEmptyProto2ScalarRequired struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val *int32 `protobuf:"varint,1,req,name=val" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto2ScalarRequired) Reset() { + *x = IgnoreEmptyProto2ScalarRequired{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2ScalarRequired) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2ScalarRequired) ProtoMessage() {} + +func (x *IgnoreEmptyProto2ScalarRequired) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2ScalarRequired.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2ScalarRequired) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{2} +} + +func (x *IgnoreEmptyProto2ScalarRequired) GetVal() int32 { + if x != nil && x.Val != nil { + return *x.Val + } + return 0 +} + +type IgnoreEmptyProto2Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val *IgnoreEmptyProto2Message_Msg `protobuf:"bytes,1,opt,name=val" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto2Message) Reset() { + *x = IgnoreEmptyProto2Message{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2Message) ProtoMessage() {} + +func (x *IgnoreEmptyProto2Message) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2Message.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2Message) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{3} +} + +func (x *IgnoreEmptyProto2Message) GetVal() *IgnoreEmptyProto2Message_Msg { + if x != nil { + return x.Val + } + return nil +} + +type IgnoreEmptyProto2Oneof struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to O: + // + // *IgnoreEmptyProto2Oneof_Val + O isIgnoreEmptyProto2Oneof_O `protobuf_oneof:"o"` +} + +func (x *IgnoreEmptyProto2Oneof) Reset() { + *x = IgnoreEmptyProto2Oneof{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2Oneof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2Oneof) ProtoMessage() {} + +func (x *IgnoreEmptyProto2Oneof) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2Oneof.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2Oneof) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{4} +} + +func (m *IgnoreEmptyProto2Oneof) GetO() isIgnoreEmptyProto2Oneof_O { + if m != nil { + return m.O + } + return nil +} + +func (x *IgnoreEmptyProto2Oneof) GetVal() int32 { + if x, ok := x.GetO().(*IgnoreEmptyProto2Oneof_Val); ok { + return x.Val + } + return 0 +} + +type isIgnoreEmptyProto2Oneof_O interface { + isIgnoreEmptyProto2Oneof_O() +} + +type IgnoreEmptyProto2Oneof_Val struct { + Val int32 `protobuf:"varint,1,opt,name=val,oneof"` +} + +func (*IgnoreEmptyProto2Oneof_Val) isIgnoreEmptyProto2Oneof_O() {} + +type IgnoreEmptyProto2Repeated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val []int32 `protobuf:"varint,1,rep,name=val" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto2Repeated) Reset() { + *x = IgnoreEmptyProto2Repeated{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2Repeated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2Repeated) ProtoMessage() {} + +func (x *IgnoreEmptyProto2Repeated) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2Repeated.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2Repeated) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{5} +} + +func (x *IgnoreEmptyProto2Repeated) GetVal() []int32 { + if x != nil { + return x.Val + } + return nil +} + +type IgnoreEmptyProto2Map struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val map[int32]int32 `protobuf:"bytes,1,rep,name=val" json:"val,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` +} + +func (x *IgnoreEmptyProto2Map) Reset() { + *x = IgnoreEmptyProto2Map{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2Map) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2Map) ProtoMessage() {} + +func (x *IgnoreEmptyProto2Map) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2Map.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2Map) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{6} +} + +func (x *IgnoreEmptyProto2Map) GetVal() map[int32]int32 { + if x != nil { + return x.Val + } + return nil +} + +type IgnoreEmptyProto2Message_Msg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val *string `protobuf:"bytes,1,opt,name=val" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto2Message_Msg) Reset() { + *x = IgnoreEmptyProto2Message_Msg{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto2Message_Msg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto2Message_Msg) ProtoMessage() {} + +func (x *IgnoreEmptyProto2Message_Msg) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto2Message_Msg.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto2Message_Msg) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *IgnoreEmptyProto2Message_Msg) GetVal() string { + if x != nil && x.Val != nil { + return *x.Val + } + return "" +} + +var File_buf_validate_conformance_cases_ignore_empty_proto2_proto protoreflect.FileDescriptor + +var file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDesc = []byte{ + 0x0a, 0x38, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x63, + 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2f, 0x63, 0x61, 0x73, 0x65, 0x73, + 0x2f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 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, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x1f, 0x49, 0x67, 0x6e, 0x6f, 0x72, + 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x53, 0x63, 0x61, 0x6c, + 0x61, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x03, 0x76, 0x61, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xd0, 0x01, 0x01, 0x1a, + 0x02, 0x20, 0x00, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x4e, 0x0a, 0x2a, 0x49, 0x67, 0x6e, 0x6f, + 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x53, 0x63, 0x61, + 0x6c, 0x61, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x57, 0x69, 0x74, 0x68, 0x44, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x20, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x3a, 0x02, 0x34, 0x32, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xd0, 0x01, 0x01, 0x1a, + 0x02, 0x20, 0x00, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x3f, 0x0a, 0x1f, 0x49, 0x67, 0x6e, 0x6f, + 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x53, 0x63, 0x61, + 0x6c, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x03, 0x76, + 0x61, 0x6c, 0x18, 0x01, 0x20, 0x02, 0x28, 0x05, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xd0, 0x01, 0x01, + 0x1a, 0x02, 0x20, 0x00, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0xc7, 0x01, 0x0a, 0x18, 0x49, 0x67, + 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x91, 0x01, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 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, 0x2e, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, + 0x73, 0x67, 0x42, 0x41, 0xba, 0x48, 0x3e, 0xba, 0x01, 0x38, 0x0a, 0x1b, 0x69, 0x67, 0x6e, 0x6f, + 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x2e, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x06, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, 0x1a, + 0x11, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x66, 0x6f, + 0x6f, 0x27, 0xd0, 0x01, 0x01, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x1a, 0x17, 0x0a, 0x03, 0x4d, 0x73, + 0x67, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x76, 0x61, 0x6c, 0x22, 0x3d, 0x0a, 0x16, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, 0x1e, 0x0a, + 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xd0, + 0x01, 0x01, 0x1a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x42, 0x03, 0x0a, + 0x01, 0x6f, 0x22, 0x3a, 0x0a, 0x19, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, + 0x1d, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x0b, 0xba, 0x48, + 0x08, 0xd0, 0x01, 0x01, 0x92, 0x01, 0x02, 0x08, 0x03, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0xac, + 0x01, 0x0a, 0x14, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x32, 0x4d, 0x61, 0x70, 0x12, 0x5c, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 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, 0x2e, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x4d, 0x61, 0x70, 0x2e, 0x56, 0x61, 0x6c, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xd0, 0x01, 0x01, 0x9a, 0x01, 0x02, 0x08, 0x03, + 0x52, 0x03, 0x76, 0x61, 0x6c, 0x1a, 0x36, 0x0a, 0x08, 0x56, 0x61, 0x6c, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xad, 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, 0x16, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x53, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2f, 0x63, 0x61, + 0x73, 0x65, 0x73, 0xa2, 0x02, 0x04, 0x42, 0x56, 0x43, 0x43, 0xaa, 0x02, 0x1e, 0x42, 0x75, 0x66, + 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x61, 0x73, 0x65, 0x73, 0xca, 0x02, 0x1e, 0x42, 0x75, + 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5c, 0x43, 0x61, 0x73, 0x65, 0x73, 0xe2, 0x02, 0x2a, 0x42, + 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5c, 0x43, 0x61, 0x73, 0x65, 0x73, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x21, 0x42, 0x75, 0x66, 0x3a, + 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x3a, 0x43, 0x61, 0x73, 0x65, 0x73, +} + +var ( + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescOnce sync.Once + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescData = file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDesc +) + +func file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescGZIP() []byte { + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescOnce.Do(func() { + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescData = protoimpl.X.CompressGZIP(file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescData) + }) + return file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDescData +} + +var file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_buf_validate_conformance_cases_ignore_empty_proto2_proto_goTypes = []interface{}{ + (*IgnoreEmptyProto2ScalarOptional)(nil), // 0: buf.validate.conformance.cases.IgnoreEmptyProto2ScalarOptional + (*IgnoreEmptyProto2ScalarOptionalWithDefault)(nil), // 1: buf.validate.conformance.cases.IgnoreEmptyProto2ScalarOptionalWithDefault + (*IgnoreEmptyProto2ScalarRequired)(nil), // 2: buf.validate.conformance.cases.IgnoreEmptyProto2ScalarRequired + (*IgnoreEmptyProto2Message)(nil), // 3: buf.validate.conformance.cases.IgnoreEmptyProto2Message + (*IgnoreEmptyProto2Oneof)(nil), // 4: buf.validate.conformance.cases.IgnoreEmptyProto2Oneof + (*IgnoreEmptyProto2Repeated)(nil), // 5: buf.validate.conformance.cases.IgnoreEmptyProto2Repeated + (*IgnoreEmptyProto2Map)(nil), // 6: buf.validate.conformance.cases.IgnoreEmptyProto2Map + (*IgnoreEmptyProto2Message_Msg)(nil), // 7: buf.validate.conformance.cases.IgnoreEmptyProto2Message.Msg + nil, // 8: buf.validate.conformance.cases.IgnoreEmptyProto2Map.ValEntry +} +var file_buf_validate_conformance_cases_ignore_empty_proto2_proto_depIdxs = []int32{ + 7, // 0: buf.validate.conformance.cases.IgnoreEmptyProto2Message.val:type_name -> buf.validate.conformance.cases.IgnoreEmptyProto2Message.Msg + 8, // 1: buf.validate.conformance.cases.IgnoreEmptyProto2Map.val:type_name -> buf.validate.conformance.cases.IgnoreEmptyProto2Map.ValEntry + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_buf_validate_conformance_cases_ignore_empty_proto2_proto_init() } +func file_buf_validate_conformance_cases_ignore_empty_proto2_proto_init() { + if File_buf_validate_conformance_cases_ignore_empty_proto2_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2ScalarOptional); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2ScalarOptionalWithDefault); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2ScalarRequired); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2Oneof); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2Repeated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2Map); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto2Message_Msg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*IgnoreEmptyProto2Oneof_Val)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_buf_validate_conformance_cases_ignore_empty_proto2_proto_goTypes, + DependencyIndexes: file_buf_validate_conformance_cases_ignore_empty_proto2_proto_depIdxs, + MessageInfos: file_buf_validate_conformance_cases_ignore_empty_proto2_proto_msgTypes, + }.Build() + File_buf_validate_conformance_cases_ignore_empty_proto2_proto = out.File + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_rawDesc = nil + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_goTypes = nil + file_buf_validate_conformance_cases_ignore_empty_proto2_proto_depIdxs = nil +} diff --git a/tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto3.pb.go b/tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto3.pb.go new file mode 100644 index 00000000..ca116e82 --- /dev/null +++ b/tools/internal/gen/buf/validate/conformance/cases/ignore_empty_proto3.pb.go @@ -0,0 +1,607 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: buf/validate/conformance/cases/ignore_empty_proto3.proto + +package cases + +import ( + _ "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type IgnoreEmptyProto3Scalar struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val int32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto3Scalar) Reset() { + *x = IgnoreEmptyProto3Scalar{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto3Scalar) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto3Scalar) ProtoMessage() {} + +func (x *IgnoreEmptyProto3Scalar) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto3Scalar.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto3Scalar) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP(), []int{0} +} + +func (x *IgnoreEmptyProto3Scalar) GetVal() int32 { + if x != nil { + return x.Val + } + return 0 +} + +type IgnoreEmptyProto3OptionalScalar struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val *int32 `protobuf:"varint,1,opt,name=val,proto3,oneof" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto3OptionalScalar) Reset() { + *x = IgnoreEmptyProto3OptionalScalar{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto3OptionalScalar) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto3OptionalScalar) ProtoMessage() {} + +func (x *IgnoreEmptyProto3OptionalScalar) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto3OptionalScalar.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto3OptionalScalar) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP(), []int{1} +} + +func (x *IgnoreEmptyProto3OptionalScalar) GetVal() int32 { + if x != nil && x.Val != nil { + return *x.Val + } + return 0 +} + +type IgnoreEmptyProto3Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val *IgnoreEmptyProto3Message_Msg `protobuf:"bytes,1,opt,name=val,proto3,oneof" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto3Message) Reset() { + *x = IgnoreEmptyProto3Message{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto3Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto3Message) ProtoMessage() {} + +func (x *IgnoreEmptyProto3Message) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto3Message.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto3Message) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP(), []int{2} +} + +func (x *IgnoreEmptyProto3Message) GetVal() *IgnoreEmptyProto3Message_Msg { + if x != nil { + return x.Val + } + return nil +} + +type IgnoreEmptyProto3Oneof struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to O: + // + // *IgnoreEmptyProto3Oneof_Val + O isIgnoreEmptyProto3Oneof_O `protobuf_oneof:"o"` +} + +func (x *IgnoreEmptyProto3Oneof) Reset() { + *x = IgnoreEmptyProto3Oneof{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto3Oneof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto3Oneof) ProtoMessage() {} + +func (x *IgnoreEmptyProto3Oneof) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto3Oneof.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto3Oneof) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP(), []int{3} +} + +func (m *IgnoreEmptyProto3Oneof) GetO() isIgnoreEmptyProto3Oneof_O { + if m != nil { + return m.O + } + return nil +} + +func (x *IgnoreEmptyProto3Oneof) GetVal() int32 { + if x, ok := x.GetO().(*IgnoreEmptyProto3Oneof_Val); ok { + return x.Val + } + return 0 +} + +type isIgnoreEmptyProto3Oneof_O interface { + isIgnoreEmptyProto3Oneof_O() +} + +type IgnoreEmptyProto3Oneof_Val struct { + Val int32 `protobuf:"varint,1,opt,name=val,proto3,oneof"` +} + +func (*IgnoreEmptyProto3Oneof_Val) isIgnoreEmptyProto3Oneof_O() {} + +type IgnoreEmptyProto3Repeated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val []int32 `protobuf:"varint,1,rep,packed,name=val,proto3" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto3Repeated) Reset() { + *x = IgnoreEmptyProto3Repeated{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto3Repeated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto3Repeated) ProtoMessage() {} + +func (x *IgnoreEmptyProto3Repeated) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto3Repeated.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto3Repeated) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP(), []int{4} +} + +func (x *IgnoreEmptyProto3Repeated) GetVal() []int32 { + if x != nil { + return x.Val + } + return nil +} + +type IgnoreEmptyProto3Map struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val map[int32]int32 `protobuf:"bytes,1,rep,name=val,proto3" json:"val,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` +} + +func (x *IgnoreEmptyProto3Map) Reset() { + *x = IgnoreEmptyProto3Map{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto3Map) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto3Map) ProtoMessage() {} + +func (x *IgnoreEmptyProto3Map) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto3Map.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto3Map) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP(), []int{5} +} + +func (x *IgnoreEmptyProto3Map) GetVal() map[int32]int32 { + if x != nil { + return x.Val + } + return nil +} + +type IgnoreEmptyProto3Message_Msg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val string `protobuf:"bytes,1,opt,name=val,proto3" json:"val,omitempty"` +} + +func (x *IgnoreEmptyProto3Message_Msg) Reset() { + *x = IgnoreEmptyProto3Message_Msg{} + if protoimpl.UnsafeEnabled { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IgnoreEmptyProto3Message_Msg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IgnoreEmptyProto3Message_Msg) ProtoMessage() {} + +func (x *IgnoreEmptyProto3Message_Msg) ProtoReflect() protoreflect.Message { + mi := &file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IgnoreEmptyProto3Message_Msg.ProtoReflect.Descriptor instead. +func (*IgnoreEmptyProto3Message_Msg) Descriptor() ([]byte, []int) { + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *IgnoreEmptyProto3Message_Msg) GetVal() string { + if x != nil { + return x.Val + } + return "" +} + +var File_buf_validate_conformance_cases_ignore_empty_proto3_proto protoreflect.FileDescriptor + +var file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDesc = []byte{ + 0x0a, 0x38, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x63, + 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2f, 0x63, 0x61, 0x73, 0x65, 0x73, + 0x2f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 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, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x37, 0x0a, 0x17, 0x49, 0x67, 0x6e, 0x6f, 0x72, + 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x53, 0x63, 0x61, 0x6c, + 0x61, 0x72, 0x12, 0x1c, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, + 0x0a, 0xba, 0x48, 0x07, 0xd0, 0x01, 0x01, 0x1a, 0x02, 0x20, 0x00, 0x52, 0x03, 0x76, 0x61, 0x6c, + 0x22, 0x4c, 0x0a, 0x1f, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x61, + 0x6c, 0x61, 0x72, 0x12, 0x21, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x42, 0x0a, 0xba, 0x48, 0x07, 0xd0, 0x01, 0x01, 0x1a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x03, + 0x76, 0x61, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x76, 0x61, 0x6c, 0x22, 0xd4, + 0x01, 0x0a, 0x18, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x96, 0x01, 0x0a, 0x03, + 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 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, 0x2e, 0x49, 0x67, 0x6e, 0x6f, 0x72, + 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x41, 0xba, 0x48, 0x3e, 0xba, 0x01, 0x38, 0x0a, + 0x1b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x06, 0x66, 0x6f, + 0x6f, 0x62, 0x61, 0x72, 0x1a, 0x11, 0x74, 0x68, 0x69, 0x73, 0x2e, 0x76, 0x61, 0x6c, 0x20, 0x3d, + 0x3d, 0x20, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0xd0, 0x01, 0x01, 0x48, 0x00, 0x52, 0x03, 0x76, 0x61, + 0x6c, 0x88, 0x01, 0x01, 0x1a, 0x17, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x76, + 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x42, 0x06, 0x0a, + 0x04, 0x5f, 0x76, 0x61, 0x6c, 0x22, 0x3d, 0x0a, 0x16, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x12, + 0x1e, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0a, 0xba, 0x48, + 0x07, 0xd0, 0x01, 0x01, 0x1a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x42, + 0x03, 0x0a, 0x01, 0x6f, 0x22, 0x3a, 0x0a, 0x19, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x1d, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x0b, + 0xba, 0x48, 0x08, 0xd0, 0x01, 0x01, 0x92, 0x01, 0x02, 0x08, 0x03, 0x52, 0x03, 0x76, 0x61, 0x6c, + 0x22, 0xac, 0x01, 0x0a, 0x14, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x61, 0x70, 0x12, 0x5c, 0x0a, 0x03, 0x76, 0x61, 0x6c, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 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, 0x2e, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4d, 0x61, 0x70, 0x2e, 0x56, 0x61, 0x6c, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xd0, 0x01, 0x01, 0x9a, 0x01, 0x02, + 0x08, 0x03, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x1a, 0x36, 0x0a, 0x08, 0x56, 0x61, 0x6c, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, + 0xad, 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, 0x16, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x75, 0x66, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2f, + 0x63, 0x61, 0x73, 0x65, 0x73, 0xa2, 0x02, 0x04, 0x42, 0x56, 0x43, 0x43, 0xaa, 0x02, 0x1e, 0x42, + 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x61, 0x73, 0x65, 0x73, 0xca, 0x02, 0x1e, + 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5c, 0x43, 0x61, 0x73, 0x65, 0x73, 0xe2, 0x02, + 0x2a, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, + 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x5c, 0x43, 0x61, 0x73, 0x65, 0x73, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x21, 0x42, 0x75, + 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x3a, 0x43, 0x61, 0x73, 0x65, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescOnce sync.Once + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescData = file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDesc +) + +func file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescGZIP() []byte { + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescOnce.Do(func() { + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescData = protoimpl.X.CompressGZIP(file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescData) + }) + return file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDescData +} + +var file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_buf_validate_conformance_cases_ignore_empty_proto3_proto_goTypes = []interface{}{ + (*IgnoreEmptyProto3Scalar)(nil), // 0: buf.validate.conformance.cases.IgnoreEmptyProto3Scalar + (*IgnoreEmptyProto3OptionalScalar)(nil), // 1: buf.validate.conformance.cases.IgnoreEmptyProto3OptionalScalar + (*IgnoreEmptyProto3Message)(nil), // 2: buf.validate.conformance.cases.IgnoreEmptyProto3Message + (*IgnoreEmptyProto3Oneof)(nil), // 3: buf.validate.conformance.cases.IgnoreEmptyProto3Oneof + (*IgnoreEmptyProto3Repeated)(nil), // 4: buf.validate.conformance.cases.IgnoreEmptyProto3Repeated + (*IgnoreEmptyProto3Map)(nil), // 5: buf.validate.conformance.cases.IgnoreEmptyProto3Map + (*IgnoreEmptyProto3Message_Msg)(nil), // 6: buf.validate.conformance.cases.IgnoreEmptyProto3Message.Msg + nil, // 7: buf.validate.conformance.cases.IgnoreEmptyProto3Map.ValEntry +} +var file_buf_validate_conformance_cases_ignore_empty_proto3_proto_depIdxs = []int32{ + 6, // 0: buf.validate.conformance.cases.IgnoreEmptyProto3Message.val:type_name -> buf.validate.conformance.cases.IgnoreEmptyProto3Message.Msg + 7, // 1: buf.validate.conformance.cases.IgnoreEmptyProto3Map.val:type_name -> buf.validate.conformance.cases.IgnoreEmptyProto3Map.ValEntry + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_buf_validate_conformance_cases_ignore_empty_proto3_proto_init() } +func file_buf_validate_conformance_cases_ignore_empty_proto3_proto_init() { + if File_buf_validate_conformance_cases_ignore_empty_proto3_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto3Scalar); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto3OptionalScalar); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto3Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto3Oneof); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto3Repeated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto3Map); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IgnoreEmptyProto3Message_Msg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[2].OneofWrappers = []interface{}{} + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*IgnoreEmptyProto3Oneof_Val)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_buf_validate_conformance_cases_ignore_empty_proto3_proto_goTypes, + DependencyIndexes: file_buf_validate_conformance_cases_ignore_empty_proto3_proto_depIdxs, + MessageInfos: file_buf_validate_conformance_cases_ignore_empty_proto3_proto_msgTypes, + }.Build() + File_buf_validate_conformance_cases_ignore_empty_proto3_proto = out.File + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_rawDesc = nil + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_goTypes = nil + file_buf_validate_conformance_cases_ignore_empty_proto3_proto_depIdxs = nil +} diff --git a/tools/protovalidate-conformance/internal/cases/cases.go b/tools/protovalidate-conformance/internal/cases/cases.go index aa12a321..ded7b6f2 100644 --- a/tools/protovalidate-conformance/internal/cases/cases.go +++ b/tools/protovalidate-conformance/internal/cases/cases.go @@ -40,6 +40,7 @@ func GlobalSuites() suites.Suites { "standard_constraints/oneof": oneofSuite(), "standard_constraints/repeated": repeatedSuite(), "standard_constraints/required": requiredSuite(), + "standard_constraints/ignore_empty": ignoreEmptySuite(), "standard_constraints/sfixed32": sfixed32Suite(), "standard_constraints/sfixed64": sfixed64Suite(), "standard_constraints/sint32": sint32Suite(), diff --git a/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go new file mode 100644 index 00000000..1e42ccb2 --- /dev/null +++ b/tools/protovalidate-conformance/internal/cases/cases_ignore_empty.go @@ -0,0 +1,196 @@ +// Copyright 2023 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cases + +import ( + "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate" + "github.com/bufbuild/protovalidate/tools/internal/gen/buf/validate/conformance/cases" + "github.com/bufbuild/protovalidate/tools/protovalidate-conformance/internal/results" + "github.com/bufbuild/protovalidate/tools/protovalidate-conformance/internal/suites" + "google.golang.org/protobuf/proto" +) + +func ignoreEmptySuite() suites.Suite { + return suites.Suite{ + "proto2/scalar/optional/nonzero/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(42)}, + Expected: results.Success(true), + }, + "proto2/scalar/optional/nonzero/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto2/scalar/optional/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptional{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto2/scalar/optional/unset": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptional{}, + Expected: results.Success(true), + }, + "proto2/scalar/optional_with_default/nonzero/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(1)}, + Expected: results.Success(true), + }, + "proto2/scalar/optional_with_default/nonzero/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto2/scalar/optional_with_default/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto2/scalar/optional_with_default/default": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{Val: proto.Int32(42)}, + Expected: results.Success(true), + }, + "proto2/scalar/optional_with_default/unset": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarOptionalWithDefault{}, + Expected: results.Success(true), + }, + "proto2/scalar/required/nonzero/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(42)}, + Expected: results.Success(true), + }, + "proto2/scalar/required/nonzero/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(-42)}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto2/scalar/required/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto2ScalarRequired{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto2/message/nonzero": suites.Case{ + Message: &cases.IgnoreEmptyProto2Message{Val: &cases.IgnoreEmptyProto2Message_Msg{Val: proto.String("foo")}}, + Expected: results.Success(true), + }, + "proto2/message/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto2Message{Val: &cases.IgnoreEmptyProto2Message_Msg{}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "ignore_empty.proto2.message"}), + }, + "proto2/message/unset": suites.Case{ + Message: &cases.IgnoreEmptyProto2Message{}, + Expected: results.Success(true), + }, + "proto2/oneof/nonzero": suites.Case{ + Message: &cases.IgnoreEmptyProto2Oneof{O: &cases.IgnoreEmptyProto2Oneof_Val{Val: 42}}, + Expected: results.Success(true), + }, + "proto2/oneof/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto2Oneof{O: &cases.IgnoreEmptyProto2Oneof_Val{}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto2/oneof/unset": suites.Case{ + Message: &cases.IgnoreEmptyProto2Oneof{}, + Expected: results.Success(true), + }, + "proto2/repeated/nonempty/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto2Repeated{Val: []int32{1, 2, 3}}, + Expected: results.Success(true), + }, + "proto2/repeated/noempty/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto2Repeated{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "repeated.min_items"}), + }, + "proto2/repeated/empty": suites.Case{ + Message: &cases.IgnoreEmptyProto2Repeated{}, + Expected: results.Success(true), + }, + "proto2/map/nonempty/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto2Map{Val: map[int32]int32{1: 2, 3: 4, 5: 6}}, + Expected: results.Success(true), + }, + "proto2/map/nonempty/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto2Map{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "map.min_pairs"}), + }, + "proto2/map/empty": suites.Case{ + Message: &cases.IgnoreEmptyProto2Map{}, + Expected: results.Success(true), + }, + "proto3/scalar/nonzero/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto3Scalar{Val: 42}, + Expected: results.Success(true), + }, + "proto3/scalar/nonzero/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto3Scalar{Val: -42}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto3/scalar/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto3Scalar{Val: 0}, + Expected: results.Success(true), + }, + "proto3/scalar/optional/nonzero": suites.Case{ + Message: &cases.IgnoreEmptyProto3OptionalScalar{Val: proto.Int32(42)}, + Expected: results.Success(true), + }, + "proto3/scalar/optional/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto3OptionalScalar{Val: proto.Int32(0)}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto3/scalar/optional/unset": suites.Case{ + Message: &cases.IgnoreEmptyProto3OptionalScalar{}, + Expected: results.Success(true), + }, + "proto3/message/nonzero": suites.Case{ + Message: &cases.IgnoreEmptyProto3Message{Val: &cases.IgnoreEmptyProto3Message_Msg{Val: "foo"}}, + Expected: results.Success(true), + }, + "proto3/message/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto3Message{Val: &cases.IgnoreEmptyProto3Message_Msg{}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "ignore_empty.proto3.message"}), + }, + "proto3/message/unset": suites.Case{ + Message: &cases.IgnoreEmptyProto3Message{}, + Expected: results.Success(true), + }, + "proto3/oneof/nonzero": suites.Case{ + Message: &cases.IgnoreEmptyProto3Oneof{O: &cases.IgnoreEmptyProto3Oneof_Val{Val: 42}}, + Expected: results.Success(true), + }, + "proto3/oneof/zero": suites.Case{ + Message: &cases.IgnoreEmptyProto3Oneof{O: &cases.IgnoreEmptyProto3Oneof_Val{}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "int32.gt"}), + }, + "proto3/oneof/unset": suites.Case{ + Message: &cases.IgnoreEmptyProto3Oneof{}, + Expected: results.Success(true), + }, + "proto3/repeated/nonempty/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto3Repeated{Val: []int32{1, 2, 3}}, + Expected: results.Success(true), + }, + "proto3/repeated/noempty/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto3Repeated{Val: []int32{1}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "repeated.min_items"}), + }, + "proto3/repeated/empty": suites.Case{ + Message: &cases.IgnoreEmptyProto3Repeated{}, + Expected: results.Success(true), + }, + "proto3/map/nonempty/valid": suites.Case{ + Message: &cases.IgnoreEmptyProto3Map{Val: map[int32]int32{1: 2, 3: 4, 5: 6}}, + Expected: results.Success(true), + }, + "proto3/map/nonempty/invalid": suites.Case{ + Message: &cases.IgnoreEmptyProto3Map{Val: map[int32]int32{0: 0}}, + Expected: results.Violations(&validate.Violation{FieldPath: "val", ConstraintId: "map.min_pairs"}), + }, + "proto3/map/empty": suites.Case{ + Message: &cases.IgnoreEmptyProto3Map{}, + Expected: results.Success(true), + }, + } +}