304 lines
7.4 KiB
Protocol Buffer
304 lines
7.4 KiB
Protocol Buffer
syntax = "proto2";
|
|
|
|
package validate;
|
|
|
|
import "google/protobuf/descriptor.proto";
|
|
import "google/protobuf/duration.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
option go_package = "github.com/envoyproxy/protoc-gen-validate/validate";
|
|
option java_package = "io.envoyproxy.pgv.validate";
|
|
|
|
message FieldRules {
|
|
optional MessageRules message = 17;
|
|
|
|
oneof type {
|
|
FloatRules float = 1;
|
|
DoubleRules double = 2;
|
|
Int32Rules int32 = 3;
|
|
Int64Rules int64 = 4;
|
|
UInt32Rules uint32 = 5;
|
|
UInt64Rules uint64 = 6;
|
|
SInt32Rules sint32 = 7;
|
|
SInt64Rules sint64 = 8;
|
|
Fixed32Rules fixed32 = 9;
|
|
Fixed64Rules fixed64 = 10;
|
|
SFixed32Rules sfixed32 = 11;
|
|
SFixed64Rules sfixed64 = 12;
|
|
BoolRules bool = 13;
|
|
StringRules string = 14;
|
|
BytesRules bytes = 15;
|
|
EnumRules enum = 16;
|
|
RepeatedRules repeated = 18;
|
|
MapRules map = 19;
|
|
AnyRules any = 20;
|
|
DurationRules duration = 21;
|
|
TimestampRules timestamp = 22;
|
|
}
|
|
}
|
|
|
|
message FloatRules {
|
|
optional float const = 1;
|
|
optional float lt = 2;
|
|
optional float lte = 3;
|
|
optional float gt = 4;
|
|
optional float gte = 5;
|
|
repeated float in = 6;
|
|
repeated float not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message DoubleRules {
|
|
optional double const = 1;
|
|
optional double lt = 2;
|
|
optional double lte = 3;
|
|
optional double gt = 4;
|
|
optional double gte = 5;
|
|
repeated double in = 6;
|
|
repeated double not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message Int32Rules {
|
|
optional int32 const = 1;
|
|
optional int32 lt = 2;
|
|
optional int32 lte = 3;
|
|
optional int32 gt = 4;
|
|
optional int32 gte = 5;
|
|
repeated int32 in = 6;
|
|
repeated int32 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message Int64Rules {
|
|
optional int64 const = 1;
|
|
optional int64 lt = 2;
|
|
optional int64 lte = 3;
|
|
optional int64 gt = 4;
|
|
optional int64 gte = 5;
|
|
repeated int64 in = 6;
|
|
repeated int64 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message UInt32Rules {
|
|
optional uint32 const = 1;
|
|
optional uint32 lt = 2;
|
|
optional uint32 lte = 3;
|
|
optional uint32 gt = 4;
|
|
optional uint32 gte = 5;
|
|
repeated uint32 in = 6;
|
|
repeated uint32 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message UInt64Rules {
|
|
optional uint64 const = 1;
|
|
optional uint64 lt = 2;
|
|
optional uint64 lte = 3;
|
|
optional uint64 gt = 4;
|
|
optional uint64 gte = 5;
|
|
repeated uint64 in = 6;
|
|
repeated uint64 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message SInt32Rules {
|
|
optional sint32 const = 1;
|
|
optional sint32 lt = 2;
|
|
optional sint32 lte = 3;
|
|
optional sint32 gt = 4;
|
|
optional sint32 gte = 5;
|
|
repeated sint32 in = 6;
|
|
repeated sint32 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message SInt64Rules {
|
|
optional sint64 const = 1;
|
|
optional sint64 lt = 2;
|
|
optional sint64 lte = 3;
|
|
optional sint64 gt = 4;
|
|
optional sint64 gte = 5;
|
|
repeated sint64 in = 6;
|
|
repeated sint64 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message Fixed32Rules {
|
|
optional fixed32 const = 1;
|
|
optional fixed32 lt = 2;
|
|
optional fixed32 lte = 3;
|
|
optional fixed32 gt = 4;
|
|
optional fixed32 gte = 5;
|
|
repeated fixed32 in = 6;
|
|
repeated fixed32 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message Fixed64Rules {
|
|
optional fixed64 const = 1;
|
|
optional fixed64 lt = 2;
|
|
optional fixed64 lte = 3;
|
|
optional fixed64 gt = 4;
|
|
optional fixed64 gte = 5;
|
|
repeated fixed64 in = 6;
|
|
repeated fixed64 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message SFixed32Rules {
|
|
optional sfixed32 const = 1;
|
|
optional sfixed32 lt = 2;
|
|
optional sfixed32 lte = 3;
|
|
optional sfixed32 gt = 4;
|
|
optional sfixed32 gte = 5;
|
|
repeated sfixed32 in = 6;
|
|
repeated sfixed32 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message SFixed64Rules {
|
|
optional sfixed64 const = 1;
|
|
optional sfixed64 lt = 2;
|
|
optional sfixed64 lte = 3;
|
|
optional sfixed64 gt = 4;
|
|
optional sfixed64 gte = 5;
|
|
repeated sfixed64 in = 6;
|
|
repeated sfixed64 not_in = 7;
|
|
optional bool ignore_empty = 8;
|
|
}
|
|
|
|
message BoolRules {
|
|
optional bool const = 1;
|
|
}
|
|
|
|
message StringRules {
|
|
optional string const = 1;
|
|
optional uint64 len = 19;
|
|
optional uint64 min_len = 2;
|
|
optional uint64 max_len = 3;
|
|
optional uint64 len_bytes = 20;
|
|
optional uint64 min_bytes = 4;
|
|
optional uint64 max_bytes = 5;
|
|
optional string pattern = 6;
|
|
optional string prefix = 7;
|
|
optional string suffix = 8;
|
|
optional string contains = 9;
|
|
optional string not_contains = 23;
|
|
repeated string in = 10;
|
|
repeated string not_in = 11;
|
|
optional bool strict = 25 [default = true];
|
|
optional bool ignore_empty = 26;
|
|
|
|
oneof well_known {
|
|
bool email = 12;
|
|
bool hostname = 13;
|
|
bool ip = 14;
|
|
bool ipv4 = 15;
|
|
bool ipv6 = 16;
|
|
bool uri = 17;
|
|
bool uri_ref = 18;
|
|
bool address = 21;
|
|
bool uuid = 22;
|
|
KnownRegex well_known_regex = 24;
|
|
}
|
|
}
|
|
|
|
message BytesRules {
|
|
optional bytes const = 1;
|
|
optional uint64 len = 13;
|
|
optional uint64 min_len = 2;
|
|
optional uint64 max_len = 3;
|
|
optional string pattern = 4;
|
|
optional bytes prefix = 5;
|
|
optional bytes suffix = 6;
|
|
optional bytes contains = 7;
|
|
repeated bytes in = 8;
|
|
repeated bytes not_in = 9;
|
|
optional bool ignore_empty = 14;
|
|
|
|
oneof well_known {
|
|
bool ip = 10;
|
|
bool ipv4 = 11;
|
|
bool ipv6 = 12;
|
|
}
|
|
}
|
|
|
|
message EnumRules {
|
|
optional int32 const = 1;
|
|
optional bool defined_only = 2;
|
|
repeated int32 in = 3;
|
|
repeated int32 not_in = 4;
|
|
}
|
|
|
|
message MessageRules {
|
|
optional bool skip = 1;
|
|
optional bool required = 2;
|
|
}
|
|
|
|
message RepeatedRules {
|
|
optional uint64 min_items = 1;
|
|
optional uint64 max_items = 2;
|
|
optional bool unique = 3;
|
|
optional FieldRules items = 4;
|
|
optional bool ignore_empty = 5;
|
|
}
|
|
|
|
message MapRules {
|
|
optional uint64 min_pairs = 1;
|
|
optional uint64 max_pairs = 2;
|
|
optional bool no_sparse = 3;
|
|
optional FieldRules keys = 4;
|
|
optional FieldRules values = 5;
|
|
optional bool ignore_empty = 6;
|
|
}
|
|
|
|
message AnyRules {
|
|
optional bool required = 1;
|
|
repeated string in = 2;
|
|
repeated string not_in = 3;
|
|
}
|
|
|
|
message DurationRules {
|
|
optional bool required = 1;
|
|
optional google.protobuf.Duration const = 2;
|
|
optional google.protobuf.Duration lt = 3;
|
|
optional google.protobuf.Duration lte = 4;
|
|
optional google.protobuf.Duration gt = 5;
|
|
optional google.protobuf.Duration gte = 6;
|
|
repeated google.protobuf.Duration in = 7;
|
|
repeated google.protobuf.Duration not_in = 8;
|
|
}
|
|
|
|
message TimestampRules {
|
|
optional bool required = 1;
|
|
optional google.protobuf.Timestamp const = 2;
|
|
optional google.protobuf.Timestamp lt = 3;
|
|
optional google.protobuf.Timestamp lte = 4;
|
|
optional google.protobuf.Timestamp gt = 5;
|
|
optional google.protobuf.Timestamp gte = 6;
|
|
optional bool lt_now = 7;
|
|
optional bool gt_now = 8;
|
|
optional google.protobuf.Duration within = 9;
|
|
}
|
|
|
|
enum KnownRegex {
|
|
UNKNOWN = 0;
|
|
HTTP_HEADER_NAME = 1;
|
|
HTTP_HEADER_VALUE = 2;
|
|
}
|
|
|
|
extend google.protobuf.MessageOptions {
|
|
optional bool disabled = 1071;
|
|
optional bool ignored = 1072;
|
|
}
|
|
|
|
extend google.protobuf.OneofOptions {
|
|
optional bool required = 1071;
|
|
}
|
|
|
|
extend google.protobuf.FieldOptions {
|
|
optional FieldRules rules = 1071;
|
|
}
|