Skip to content

Commit

Permalink
Revert "Revert protovalidate-testing changes (#254)"
Browse files Browse the repository at this point in the history
This reverts commit 4b5f873.
  • Loading branch information
rodaine authored Sep 20, 2024
1 parent 4b5f873 commit 978eaa5
Show file tree
Hide file tree
Showing 30 changed files with 16,697 additions and 6,297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ message BoolConstTrue {
message BoolConstFalse {
bool val = 1 [(buf.validate.field).bool.const = false];
}
message BoolExample {
bool val = 1 [(buf.validate.field).bool.example = true];
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,27 @@ message BytesSuffix {
message BytesIP {
bytes val = 1 [(buf.validate.field).bytes.ip = true];
}
message BytesNotIP {
bytes val = 1 [(buf.validate.field).bytes.ip = false];
}
message BytesIPv4 {
bytes val = 1 [(buf.validate.field).bytes.ipv4 = true];
}
message BytesNotIPv4 {
bytes val = 1 [(buf.validate.field).bytes.ipv4 = false];
}
message BytesIPv6 {
bytes val = 1 [(buf.validate.field).bytes.ipv6 = true];
}
message BytesNotIPv6 {
bytes val = 1 [(buf.validate.field).bytes.ipv6 = false];
}
message BytesIPv6Ignore {
bytes val = 1 [
(buf.validate.field).bytes.ipv6 = true,
(buf.validate.field).ignore_empty = true
];
}
message BytesExample {
bytes val = 1 [(buf.validate.field).bytes.example = "\x99"];
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,7 @@ message EnumInsideOneof {
}];
}
}

message EnumExample {
TestEnum val = 1 [(buf.validate.field).enum.example = 2];
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ message FloatExGTELTE {
message FloatFinite {
float val = 1 [(buf.validate.field).float.finite = true];
}
message FloatNotFinite {
float val = 1 [(buf.validate.field).float.finite = false];
}
message FloatIgnore {
float val = 1 [
(buf.validate.field).float = {
Expand All @@ -90,6 +93,10 @@ message FloatIncorrectType {
float val = 1 [(buf.validate.field).double.gt = 0];
}

message FloatExample {
float val = 1 [(buf.validate.field).float.example = 8];
}

message DoubleNone {
double val = 1;
}
Expand Down Expand Up @@ -148,6 +155,9 @@ message DoubleExGTELTE {
message DoubleFinite {
double val = 1 [(buf.validate.field).double.finite = true];
}
message DoubleNotFinite {
double val = 1 [(buf.validate.field).double.finite = false];
}
message DoubleIgnore {
double val = 1 [
(buf.validate.field).double = {
Expand All @@ -162,6 +172,10 @@ message DoubleIncorrectType {
double val = 1 [(buf.validate.field).float.gt = 0];
}

message DoubleExample {
double val = 1 [(buf.validate.field).double.example = 0];
}

message Int32None {
int32 val = 1;
}
Expand Down Expand Up @@ -231,6 +245,10 @@ message Int32IncorrectType {
int32 val = 1 [(buf.validate.field).float.gt = 0];
}

message Int32Example {
int32 val = 1 [(buf.validate.field).int32.example = 10];
}

message Int64None {
int64 val = 1;
}
Expand Down Expand Up @@ -325,6 +343,10 @@ message Int64IncorrectType {
int64 val = 1 [(buf.validate.field).float.gt = 0];
}

message Int64Example {
int64 val = 1 [(buf.validate.field).int64.example = 10];
}

message UInt32None {
uint32 val = 1;
}
Expand Down Expand Up @@ -394,6 +416,10 @@ message UInt32IncorrectType {
uint32 val = 1 [(buf.validate.field).float.gt = 0];
}

message UInt32Example {
uint32 val = 1 [(buf.validate.field).uint32.example = 0];
}

message UInt64None {
uint64 val = 1;
}
Expand Down Expand Up @@ -463,6 +489,10 @@ message UInt64IncorrectType {
uint64 val = 1 [(buf.validate.field).float.gt = 0];
}

message UInt64Example {
uint64 val = 1 [(buf.validate.field).uint64.example = 0];
}

message SInt32None {
sint32 val = 1;
}
Expand Down Expand Up @@ -532,6 +562,10 @@ message SInt32IncorrectType {
sint32 val = 1 [(buf.validate.field).float.gt = 0];
}

message SInt32Example {
sint32 val = 1 [(buf.validate.field).sint32.example = 0];
}

message SInt64None {
sint64 val = 1;
}
Expand Down Expand Up @@ -600,6 +634,10 @@ message SInt64IncorrectType {
sint64 val = 1 [(buf.validate.field).float.gt = 0];
}

message SInt64Example {
sint64 val = 1 [(buf.validate.field).sint64.example = 0];
}

message Fixed32None {
fixed32 val = 1;
}
Expand Down Expand Up @@ -669,6 +707,10 @@ message Fixed32IncorrectType {
fixed32 val = 1 [(buf.validate.field).float.gt = 0];
}

message Fixed32Example {
fixed32 val = 1 [(buf.validate.field).fixed32.example = 0];
}

message Fixed64None {
fixed64 val = 1;
}
Expand Down Expand Up @@ -738,6 +780,10 @@ message Fixed64IncorrectType {
fixed64 val = 1 [(buf.validate.field).float.gt = 0];
}

message Fixed64Example {
fixed64 val = 1 [(buf.validate.field).fixed64.example = 0];
}

message SFixed32None {
sfixed32 val = 1;
}
Expand Down Expand Up @@ -807,6 +853,10 @@ message SFixed32IncorrectType {
sfixed32 val = 1 [(buf.validate.field).float.gt = 0];
}

message SFixed32Example {
sfixed32 val = 1 [(buf.validate.field).sfixed32.example = 0];
}

message SFixed64None {
sfixed64 val = 1;
}
Expand Down Expand Up @@ -876,6 +926,10 @@ message SFixed64IncorrectType {
sfixed64 val = 1 [(buf.validate.field).float.gt = 0];
}

message SFixed64Example {
sfixed64 val = 1 [(buf.validate.field).sfixed64.example = 0];
}

message Int64LTEOptional {
optional int64 val = 1 [(buf.validate.field).int64.lte = 64];
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ message RepeatedExact {
message RepeatedUnique {
repeated string val = 1 [(buf.validate.field).repeated.unique = true];
}
message RepeatedNotUnique {
repeated string val = 1 [(buf.validate.field).repeated.unique = false];
}
message RepeatedMultipleUnique {
repeated string a = 1 [(buf.validate.field).repeated.unique = true];
repeated int32 b = 2 [(buf.validate.field).repeated.unique = true];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,51 +103,99 @@ message StringSuffix {
message StringEmail {
string val = 1 [(buf.validate.field).string.email = true];
}
message StringNotEmail {
string val = 1 [(buf.validate.field).string.email = false];
}
message StringAddress {
string val = 1 [(buf.validate.field).string.address = true];
}
message StringNotAddress {
string val = 1 [(buf.validate.field).string.address = false];
}
message StringHostname {
string val = 1 [(buf.validate.field).string.hostname = true];
}
message StringNotHostname {
string val = 1 [(buf.validate.field).string.hostname = false];
}
message StringIP {
string val = 1 [(buf.validate.field).string.ip = true];
}
message StringNotIP {
string val = 1 [(buf.validate.field).string.ip = false];
}
message StringIPv4 {
string val = 1 [(buf.validate.field).string.ipv4 = true];
}
message StringNotIPv4 {
string val = 1 [(buf.validate.field).string.ipv4 = false];
}
message StringIPv6 {
string val = 1 [(buf.validate.field).string.ipv6 = true];
}
message StringNotIPv6 {
string val = 1 [(buf.validate.field).string.ipv6 = false];
}
message StringIPWithPrefixLen {
string val = 1 [(buf.validate.field).string.ip_with_prefixlen = true];
}
message StringNotIPWithPrefixLen {
string val = 1 [(buf.validate.field).string.ip_with_prefixlen = false];
}
message StringIPv4WithPrefixLen {
string val = 1 [(buf.validate.field).string.ipv4_with_prefixlen = true];
}
message StringNotIPv4WithPrefixLen {
string val = 1 [(buf.validate.field).string.ipv4_with_prefixlen = false];
}
message StringIPv6WithPrefixLen {
string val = 1 [(buf.validate.field).string.ipv6_with_prefixlen = true];
}
message StringNotIPv6WithPrefixLen {
string val = 1 [(buf.validate.field).string.ipv6_with_prefixlen = false];
}
message StringIPPrefix {
string val = 1 [(buf.validate.field).string.ip_prefix = true];
}
message StringNotIPPrefix {
string val = 1 [(buf.validate.field).string.ip_prefix = false];
}
message StringIPv4Prefix {
string val = 1 [(buf.validate.field).string.ipv4_prefix = true];
}
message StringNotIPv4Prefix {
string val = 1 [(buf.validate.field).string.ipv4_prefix = false];
}
message StringIPv6Prefix {
string val = 1 [(buf.validate.field).string.ipv6_prefix = true];
}
message StringNotIPv6Prefix {
string val = 1 [(buf.validate.field).string.ipv6_prefix = false];
}
message StringURI {
string val = 1 [(buf.validate.field).string.uri = true];
}
message StringNotURI {
string val = 1 [(buf.validate.field).string.uri = false];
}
message StringURIRef {
string val = 1 [(buf.validate.field).string.uri_ref = true];
}
message StringNotURIRef {
string val = 1 [(buf.validate.field).string.uri_ref = false];
}
message StringUUID {
string val = 1 [(buf.validate.field).string.uuid = true];
}
message StringNotUUID {
string val = 1 [(buf.validate.field).string.uuid = false];
}
message StringTUUID {
string val = 1 [(buf.validate.field).string.tuuid = true];
}
message StringNotTUUID {
string val = 1 [(buf.validate.field).string.tuuid = false];
}
message StringHttpHeaderName {
string val = 1 [(buf.validate.field).string.well_known_regex = KNOWN_REGEX_HTTP_HEADER_NAME];
}
Expand Down Expand Up @@ -195,3 +243,7 @@ message StringHostAndOptionalPort {
expression: "this.isHostAndPort(false)"
}];
}

message StringExample {
string val = 1 [(buf.validate.field).string.example = "foo"];
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ message DurationFieldWithOtherFields {
google.protobuf.Duration duration_val = 1 [(buf.validate.field).duration.lte = {seconds: 1}];
int32 int_val = 2 [(buf.validate.field).int32.gt = 16];
}

message DurationExample {
google.protobuf.Duration val = 1 [(buf.validate.field).duration.example = {seconds: 3}];
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ message TimestampExGTELTE {
message TimestampLTNow {
google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.lt_now = true];
}
message TimestampNotLTNow {
google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.lt_now = false];
}
message TimestampGTNow {
google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.gt_now = true];
}
message TimestampNotGTNow {
google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.gt_now = false];
}

message TimestampWithin {
google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.within.seconds = 3600];
Expand All @@ -89,3 +95,7 @@ message TimestampGTNowWithin {
within: {seconds: 3600}
}];
}

message TimestampExample {
google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.example = {seconds: 3}];
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ proto_library(
strip_import_prefix = "/proto/protovalidate-testing",
visibility = ["//visibility:public"],
deps = [
"@buf_deps_proto_protovalidate-testing//buf/validate:validate_proto",
"//proto/protovalidate/buf/validate:validate_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ syntax = "proto3";

package buf.validate.conformance.harness;

import "buf/validate/expression.proto";
import "buf/validate/validate.proto";

Check failure on line 19 in proto/protovalidate-testing/buf/validate/conformance/harness/harness.proto

View workflow job for this annotation

GitHub Actions / buf

import "buf/validate/expression.proto": file does not exist
import "google/protobuf/any.proto";
import "google/protobuf/descriptor.proto";

Expand Down
Loading

0 comments on commit 978eaa5

Please sign in to comment.