@mochabug/adapt-plugin-toolkit
Version:
The API toolkit to facilitate mochabug adapt plugin development
1,418 lines • 301 kB
TypeScript
import type { GenEnum, GenExtension, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
import type { Duration, DurationJson, FieldDescriptorProto_Type, FieldDescriptorProto_TypeJson, FieldOptions, MessageOptions, OneofOptions, Timestamp, TimestampJson } from "@bufbuild/protobuf/wkt";
import type { Message } from "@bufbuild/protobuf";
/**
* Describes the file buf/validate/validate.proto.
*/
export declare const file_buf_validate_validate: GenFile;
/**
* `Rule` represents a validation rule written in the Common Expression
* Language (CEL) syntax. Each Rule includes a unique identifier, an
* optional error message, and the CEL expression to evaluate. For more
* information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
*
* ```proto
* message Foo {
* option (buf.validate.message).cel = {
* id: "foo.bar"
* message: "bar must be greater than 0"
* expression: "this.bar > 0"
* };
* int32 bar = 1;
* }
* ```
*
* @generated from message buf.validate.Rule
*/
export type Rule = Message<"buf.validate.Rule"> & {
/**
* `id` is a string that serves as a machine-readable name for this Rule.
* It should be unique within its scope, which could be either a message or a field.
*
* @generated from field: optional string id = 1;
*/
id: string;
/**
* `message` is an optional field that provides a human-readable error message
* for this Rule when the CEL expression evaluates to false. If a
* non-empty message is provided, any strings resulting from the CEL
* expression evaluation are ignored.
*
* @generated from field: optional string message = 2;
*/
message: string;
/**
* `expression` is the actual CEL expression that will be evaluated for
* validation. This string must resolve to either a boolean or a string
* value. If the expression evaluates to false or a non-empty string, the
* validation is considered failed, and the message is rejected.
*
* @generated from field: optional string expression = 3;
*/
expression: string;
};
/**
* `Rule` represents a validation rule written in the Common Expression
* Language (CEL) syntax. Each Rule includes a unique identifier, an
* optional error message, and the CEL expression to evaluate. For more
* information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
*
* ```proto
* message Foo {
* option (buf.validate.message).cel = {
* id: "foo.bar"
* message: "bar must be greater than 0"
* expression: "this.bar > 0"
* };
* int32 bar = 1;
* }
* ```
*
* @generated from message buf.validate.Rule
*/
export type RuleJson = {
/**
* `id` is a string that serves as a machine-readable name for this Rule.
* It should be unique within its scope, which could be either a message or a field.
*
* @generated from field: optional string id = 1;
*/
id?: string;
/**
* `message` is an optional field that provides a human-readable error message
* for this Rule when the CEL expression evaluates to false. If a
* non-empty message is provided, any strings resulting from the CEL
* expression evaluation are ignored.
*
* @generated from field: optional string message = 2;
*/
message?: string;
/**
* `expression` is the actual CEL expression that will be evaluated for
* validation. This string must resolve to either a boolean or a string
* value. If the expression evaluates to false or a non-empty string, the
* validation is considered failed, and the message is rejected.
*
* @generated from field: optional string expression = 3;
*/
expression?: string;
};
/**
* Describes the message buf.validate.Rule.
* Use `create(RuleSchema)` to create a new message.
*/
export declare const RuleSchema: GenMessage<Rule, {
jsonType: RuleJson;
}>;
/**
* MessageRules represents validation rules that are applied to the entire message.
* It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules.
*
* @generated from message buf.validate.MessageRules
*/
export type MessageRules = Message<"buf.validate.MessageRules"> & {
/**
* `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message.
* These rules are written in Common Expression Language (CEL) syntax. For more information,
* [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
*
*
* ```proto
* message MyMessage {
* // The field `foo` must be greater than 42.
* option (buf.validate.message).cel = {
* id: "my_message.value",
* message: "value must be greater than 42",
* expression: "this.foo > 42",
* };
* optional int32 foo = 1;
* }
* ```
*
* @generated from field: repeated buf.validate.Rule cel = 3;
*/
cel: Rule[];
/**
* `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields
* of which at most one can be present. If `required` is also specified, then exactly one
* of the specified fields _must_ be present.
*
* This will enforce oneof-like constraints with a few features not provided by
* actual Protobuf oneof declarations:
* 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof,
* only scalar fields are allowed.
* 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member
* fields have explicit presence. This means that, for the purpose of determining
* how many fields are set, explicitly setting such a field to its zero value is
* effectively the same as not setting it at all.
* 3. This will always generate validation errors for a message unmarshalled from
* serialized data that sets more than one field. With a Protobuf oneof, when
* multiple fields are present in the serialized form, earlier values are usually
* silently ignored when unmarshalling, with only the last field being set when
* unmarshalling completes.
*
* Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means
* only the field that is set will be validated and the unset fields are not validated according to the field rules.
* This behavior can be overridden by setting `ignore` against a field.
*
* ```proto
* message MyMessage {
* // Only one of `field1` or `field2` _can_ be present in this message.
* option (buf.validate.message).oneof = { fields: ["field1", "field2"] };
* // Exactly one of `field3` or `field4` _must_ be present in this message.
* option (buf.validate.message).oneof = { fields: ["field3", "field4"], required: true };
* string field1 = 1;
* bytes field2 = 2;
* bool field3 = 3;
* int32 field4 = 4;
* }
* ```
*
* @generated from field: repeated buf.validate.MessageOneofRule oneof = 4;
*/
oneof: MessageOneofRule[];
};
/**
* MessageRules represents validation rules that are applied to the entire message.
* It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules.
*
* @generated from message buf.validate.MessageRules
*/
export type MessageRulesJson = {
/**
* `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message.
* These rules are written in Common Expression Language (CEL) syntax. For more information,
* [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
*
*
* ```proto
* message MyMessage {
* // The field `foo` must be greater than 42.
* option (buf.validate.message).cel = {
* id: "my_message.value",
* message: "value must be greater than 42",
* expression: "this.foo > 42",
* };
* optional int32 foo = 1;
* }
* ```
*
* @generated from field: repeated buf.validate.Rule cel = 3;
*/
cel?: RuleJson[];
/**
* `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields
* of which at most one can be present. If `required` is also specified, then exactly one
* of the specified fields _must_ be present.
*
* This will enforce oneof-like constraints with a few features not provided by
* actual Protobuf oneof declarations:
* 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof,
* only scalar fields are allowed.
* 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member
* fields have explicit presence. This means that, for the purpose of determining
* how many fields are set, explicitly setting such a field to its zero value is
* effectively the same as not setting it at all.
* 3. This will always generate validation errors for a message unmarshalled from
* serialized data that sets more than one field. With a Protobuf oneof, when
* multiple fields are present in the serialized form, earlier values are usually
* silently ignored when unmarshalling, with only the last field being set when
* unmarshalling completes.
*
* Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means
* only the field that is set will be validated and the unset fields are not validated according to the field rules.
* This behavior can be overridden by setting `ignore` against a field.
*
* ```proto
* message MyMessage {
* // Only one of `field1` or `field2` _can_ be present in this message.
* option (buf.validate.message).oneof = { fields: ["field1", "field2"] };
* // Exactly one of `field3` or `field4` _must_ be present in this message.
* option (buf.validate.message).oneof = { fields: ["field3", "field4"], required: true };
* string field1 = 1;
* bytes field2 = 2;
* bool field3 = 3;
* int32 field4 = 4;
* }
* ```
*
* @generated from field: repeated buf.validate.MessageOneofRule oneof = 4;
*/
oneof?: MessageOneofRuleJson[];
};
/**
* Describes the message buf.validate.MessageRules.
* Use `create(MessageRulesSchema)` to create a new message.
*/
export declare const MessageRulesSchema: GenMessage<MessageRules, {
jsonType: MessageRulesJson;
}>;
/**
* @generated from message buf.validate.MessageOneofRule
*/
export type MessageOneofRule = Message<"buf.validate.MessageOneofRule"> & {
/**
* A list of field names to include in the oneof. All field names must be
* defined in the message. At least one field must be specified, and
* duplicates are not permitted.
*
* @generated from field: repeated string fields = 1;
*/
fields: string[];
/**
* If true, one of the fields specified _must_ be set.
*
* @generated from field: optional bool required = 2;
*/
required: boolean;
};
/**
* @generated from message buf.validate.MessageOneofRule
*/
export type MessageOneofRuleJson = {
/**
* A list of field names to include in the oneof. All field names must be
* defined in the message. At least one field must be specified, and
* duplicates are not permitted.
*
* @generated from field: repeated string fields = 1;
*/
fields?: string[];
/**
* If true, one of the fields specified _must_ be set.
*
* @generated from field: optional bool required = 2;
*/
required?: boolean;
};
/**
* Describes the message buf.validate.MessageOneofRule.
* Use `create(MessageOneofRuleSchema)` to create a new message.
*/
export declare const MessageOneofRuleSchema: GenMessage<MessageOneofRule, {
jsonType: MessageOneofRuleJson;
}>;
/**
* The `OneofRules` message type enables you to manage rules for
* oneof fields in your protobuf messages.
*
* @generated from message buf.validate.OneofRules
*/
export type OneofRules = Message<"buf.validate.OneofRules"> & {
/**
* If `required` is true, exactly one field of the oneof must be set. A
* validation error is returned if no fields in the oneof are set. Further rules
* should be placed on the fields themselves to ensure they are valid values,
* such as `min_len` or `gt`.
*
* ```proto
* message MyMessage {
* oneof value {
* // Either `a` or `b` must be set. If `a` is set, it must also be
* // non-empty; whereas if `b` is set, it can still be an empty string.
* option (buf.validate.oneof).required = true;
* string a = 1 [(buf.validate.field).string.min_len = 1];
* string b = 2;
* }
* }
* ```
*
* @generated from field: optional bool required = 1;
*/
required: boolean;
};
/**
* The `OneofRules` message type enables you to manage rules for
* oneof fields in your protobuf messages.
*
* @generated from message buf.validate.OneofRules
*/
export type OneofRulesJson = {
/**
* If `required` is true, exactly one field of the oneof must be set. A
* validation error is returned if no fields in the oneof are set. Further rules
* should be placed on the fields themselves to ensure they are valid values,
* such as `min_len` or `gt`.
*
* ```proto
* message MyMessage {
* oneof value {
* // Either `a` or `b` must be set. If `a` is set, it must also be
* // non-empty; whereas if `b` is set, it can still be an empty string.
* option (buf.validate.oneof).required = true;
* string a = 1 [(buf.validate.field).string.min_len = 1];
* string b = 2;
* }
* }
* ```
*
* @generated from field: optional bool required = 1;
*/
required?: boolean;
};
/**
* Describes the message buf.validate.OneofRules.
* Use `create(OneofRulesSchema)` to create a new message.
*/
export declare const OneofRulesSchema: GenMessage<OneofRules, {
jsonType: OneofRulesJson;
}>;
/**
* FieldRules encapsulates the rules for each type of field. Depending on
* the field, the correct set should be used to ensure proper validations.
*
* @generated from message buf.validate.FieldRules
*/
export type FieldRules = Message<"buf.validate.FieldRules"> & {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information,
* [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
*
* ```proto
* message MyMessage {
* // The field `value` must be greater than 42.
* optional int32 value = 1 [(buf.validate.field).cel = {
* id: "my_message.value",
* message: "value must be greater than 42",
* expression: "this > 42",
* }];
* }
* ```
*
* @generated from field: repeated buf.validate.Rule cel = 23;
*/
cel: Rule[];
/**
* If `required` is true, the field must be set. A validation error is returned
* if the field is not set.
*
* ```proto
* syntax="proto3";
*
* message FieldsWithPresence {
* // Requires any string to be set, including the empty string.
* optional string link = 1 [
* (buf.validate.field).required = true
* ];
* // Requires true or false to be set.
* optional bool disabled = 2 [
* (buf.validate.field).required = true
* ];
* // Requires a message to be set, including the empty message.
* SomeMessage msg = 4 [
* (buf.validate.field).required = true
* ];
* }
* ```
*
* All fields in the example above track presence. By default, Protovalidate
* ignores rules on those fields if no value is set. `required` ensures that
* the fields are set and valid.
*
* Fields that don't track presence are always validated by Protovalidate,
* whether they are set or not. It is not necessary to add `required`. It
* can be added to indicate that the field cannot be the zero value.
*
* ```proto
* syntax="proto3";
*
* message FieldsWithoutPresence {
* // `string.email` always applies, even to an empty string.
* string link = 1 [
* (buf.validate.field).string.email = true
* ];
* // `repeated.min_items` always applies, even to an empty list.
* repeated string labels = 2 [
* (buf.validate.field).repeated.min_items = 1
* ];
* // `required`, for fields that don't track presence, indicates
* // the value of the field can't be the zero value.
* int32 zero_value_not_allowed = 3 [
* (buf.validate.field).required = true
* ];
* }
* ```
*
* To learn which fields track presence, see the
* [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
*
* Note: While field rules can be applied to repeated items, map keys, and map
* values, the elements are always considered to be set. Consequently,
* specifying `repeated.items.required` is redundant.
*
* @generated from field: optional bool required = 25;
*/
required: boolean;
/**
* Ignore validation rules on the field if its value matches the specified
* criteria. See the `Ignore` enum for details.
*
* ```proto
* message UpdateRequest {
* // The uri rule only applies if the field is not an empty string.
* string url = 1 [
* (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
* (buf.validate.field).string.uri = true
* ];
* }
* ```
*
* @generated from field: optional buf.validate.Ignore ignore = 27;
*/
ignore: Ignore;
/**
* @generated from oneof buf.validate.FieldRules.type
*/
type: {
/**
* Scalar Field Types
*
* @generated from field: buf.validate.FloatRules float = 1;
*/
value: FloatRules;
case: "float";
} | {
/**
* @generated from field: buf.validate.DoubleRules double = 2;
*/
value: DoubleRules;
case: "double";
} | {
/**
* @generated from field: buf.validate.Int32Rules int32 = 3;
*/
value: Int32Rules;
case: "int32";
} | {
/**
* @generated from field: buf.validate.Int64Rules int64 = 4;
*/
value: Int64Rules;
case: "int64";
} | {
/**
* @generated from field: buf.validate.UInt32Rules uint32 = 5;
*/
value: UInt32Rules;
case: "uint32";
} | {
/**
* @generated from field: buf.validate.UInt64Rules uint64 = 6;
*/
value: UInt64Rules;
case: "uint64";
} | {
/**
* @generated from field: buf.validate.SInt32Rules sint32 = 7;
*/
value: SInt32Rules;
case: "sint32";
} | {
/**
* @generated from field: buf.validate.SInt64Rules sint64 = 8;
*/
value: SInt64Rules;
case: "sint64";
} | {
/**
* @generated from field: buf.validate.Fixed32Rules fixed32 = 9;
*/
value: Fixed32Rules;
case: "fixed32";
} | {
/**
* @generated from field: buf.validate.Fixed64Rules fixed64 = 10;
*/
value: Fixed64Rules;
case: "fixed64";
} | {
/**
* @generated from field: buf.validate.SFixed32Rules sfixed32 = 11;
*/
value: SFixed32Rules;
case: "sfixed32";
} | {
/**
* @generated from field: buf.validate.SFixed64Rules sfixed64 = 12;
*/
value: SFixed64Rules;
case: "sfixed64";
} | {
/**
* @generated from field: buf.validate.BoolRules bool = 13;
*/
value: BoolRules;
case: "bool";
} | {
/**
* @generated from field: buf.validate.StringRules string = 14;
*/
value: StringRules;
case: "string";
} | {
/**
* @generated from field: buf.validate.BytesRules bytes = 15;
*/
value: BytesRules;
case: "bytes";
} | {
/**
* Complex Field Types
*
* @generated from field: buf.validate.EnumRules enum = 16;
*/
value: EnumRules;
case: "enum";
} | {
/**
* @generated from field: buf.validate.RepeatedRules repeated = 18;
*/
value: RepeatedRules;
case: "repeated";
} | {
/**
* @generated from field: buf.validate.MapRules map = 19;
*/
value: MapRules;
case: "map";
} | {
/**
* Well-Known Field Types
*
* @generated from field: buf.validate.AnyRules any = 20;
*/
value: AnyRules;
case: "any";
} | {
/**
* @generated from field: buf.validate.DurationRules duration = 21;
*/
value: DurationRules;
case: "duration";
} | {
/**
* @generated from field: buf.validate.TimestampRules timestamp = 22;
*/
value: TimestampRules;
case: "timestamp";
} | {
case: undefined;
value?: undefined;
};
};
/**
* FieldRules encapsulates the rules for each type of field. Depending on
* the field, the correct set should be used to ensure proper validations.
*
* @generated from message buf.validate.FieldRules
*/
export type FieldRulesJson = {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information,
* [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/).
*
* ```proto
* message MyMessage {
* // The field `value` must be greater than 42.
* optional int32 value = 1 [(buf.validate.field).cel = {
* id: "my_message.value",
* message: "value must be greater than 42",
* expression: "this > 42",
* }];
* }
* ```
*
* @generated from field: repeated buf.validate.Rule cel = 23;
*/
cel?: RuleJson[];
/**
* If `required` is true, the field must be set. A validation error is returned
* if the field is not set.
*
* ```proto
* syntax="proto3";
*
* message FieldsWithPresence {
* // Requires any string to be set, including the empty string.
* optional string link = 1 [
* (buf.validate.field).required = true
* ];
* // Requires true or false to be set.
* optional bool disabled = 2 [
* (buf.validate.field).required = true
* ];
* // Requires a message to be set, including the empty message.
* SomeMessage msg = 4 [
* (buf.validate.field).required = true
* ];
* }
* ```
*
* All fields in the example above track presence. By default, Protovalidate
* ignores rules on those fields if no value is set. `required` ensures that
* the fields are set and valid.
*
* Fields that don't track presence are always validated by Protovalidate,
* whether they are set or not. It is not necessary to add `required`. It
* can be added to indicate that the field cannot be the zero value.
*
* ```proto
* syntax="proto3";
*
* message FieldsWithoutPresence {
* // `string.email` always applies, even to an empty string.
* string link = 1 [
* (buf.validate.field).string.email = true
* ];
* // `repeated.min_items` always applies, even to an empty list.
* repeated string labels = 2 [
* (buf.validate.field).repeated.min_items = 1
* ];
* // `required`, for fields that don't track presence, indicates
* // the value of the field can't be the zero value.
* int32 zero_value_not_allowed = 3 [
* (buf.validate.field).required = true
* ];
* }
* ```
*
* To learn which fields track presence, see the
* [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat).
*
* Note: While field rules can be applied to repeated items, map keys, and map
* values, the elements are always considered to be set. Consequently,
* specifying `repeated.items.required` is redundant.
*
* @generated from field: optional bool required = 25;
*/
required?: boolean;
/**
* Ignore validation rules on the field if its value matches the specified
* criteria. See the `Ignore` enum for details.
*
* ```proto
* message UpdateRequest {
* // The uri rule only applies if the field is not an empty string.
* string url = 1 [
* (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE,
* (buf.validate.field).string.uri = true
* ];
* }
* ```
*
* @generated from field: optional buf.validate.Ignore ignore = 27;
*/
ignore?: IgnoreJson;
/**
* Scalar Field Types
*
* @generated from field: buf.validate.FloatRules float = 1;
*/
float?: FloatRulesJson;
/**
* @generated from field: buf.validate.DoubleRules double = 2;
*/
double?: DoubleRulesJson;
/**
* @generated from field: buf.validate.Int32Rules int32 = 3;
*/
int32?: Int32RulesJson;
/**
* @generated from field: buf.validate.Int64Rules int64 = 4;
*/
int64?: Int64RulesJson;
/**
* @generated from field: buf.validate.UInt32Rules uint32 = 5;
*/
uint32?: UInt32RulesJson;
/**
* @generated from field: buf.validate.UInt64Rules uint64 = 6;
*/
uint64?: UInt64RulesJson;
/**
* @generated from field: buf.validate.SInt32Rules sint32 = 7;
*/
sint32?: SInt32RulesJson;
/**
* @generated from field: buf.validate.SInt64Rules sint64 = 8;
*/
sint64?: SInt64RulesJson;
/**
* @generated from field: buf.validate.Fixed32Rules fixed32 = 9;
*/
fixed32?: Fixed32RulesJson;
/**
* @generated from field: buf.validate.Fixed64Rules fixed64 = 10;
*/
fixed64?: Fixed64RulesJson;
/**
* @generated from field: buf.validate.SFixed32Rules sfixed32 = 11;
*/
sfixed32?: SFixed32RulesJson;
/**
* @generated from field: buf.validate.SFixed64Rules sfixed64 = 12;
*/
sfixed64?: SFixed64RulesJson;
/**
* @generated from field: buf.validate.BoolRules bool = 13;
*/
bool?: BoolRulesJson;
/**
* @generated from field: buf.validate.StringRules string = 14;
*/
string?: StringRulesJson;
/**
* @generated from field: buf.validate.BytesRules bytes = 15;
*/
bytes?: BytesRulesJson;
/**
* Complex Field Types
*
* @generated from field: buf.validate.EnumRules enum = 16;
*/
enum?: EnumRulesJson;
/**
* @generated from field: buf.validate.RepeatedRules repeated = 18;
*/
repeated?: RepeatedRulesJson;
/**
* @generated from field: buf.validate.MapRules map = 19;
*/
map?: MapRulesJson;
/**
* Well-Known Field Types
*
* @generated from field: buf.validate.AnyRules any = 20;
*/
any?: AnyRulesJson;
/**
* @generated from field: buf.validate.DurationRules duration = 21;
*/
duration?: DurationRulesJson;
/**
* @generated from field: buf.validate.TimestampRules timestamp = 22;
*/
timestamp?: TimestampRulesJson;
};
/**
* Describes the message buf.validate.FieldRules.
* Use `create(FieldRulesSchema)` to create a new message.
*/
export declare const FieldRulesSchema: GenMessage<FieldRules, {
jsonType: FieldRulesJson;
}>;
/**
* PredefinedRules are custom rules that can be re-used with
* multiple fields.
*
* @generated from message buf.validate.PredefinedRules
*/
export type PredefinedRules = Message<"buf.validate.PredefinedRules"> & {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information,
* [see our documentation](https://buf.build/docs/protovalidate/schemas/predefined-rules/).
*
* ```proto
* message MyMessage {
* // The field `value` must be greater than 42.
* optional int32 value = 1 [(buf.validate.predefined).cel = {
* id: "my_message.value",
* message: "value must be greater than 42",
* expression: "this > 42",
* }];
* }
* ```
*
* @generated from field: repeated buf.validate.Rule cel = 1;
*/
cel: Rule[];
};
/**
* PredefinedRules are custom rules that can be re-used with
* multiple fields.
*
* @generated from message buf.validate.PredefinedRules
*/
export type PredefinedRulesJson = {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information,
* [see our documentation](https://buf.build/docs/protovalidate/schemas/predefined-rules/).
*
* ```proto
* message MyMessage {
* // The field `value` must be greater than 42.
* optional int32 value = 1 [(buf.validate.predefined).cel = {
* id: "my_message.value",
* message: "value must be greater than 42",
* expression: "this > 42",
* }];
* }
* ```
*
* @generated from field: repeated buf.validate.Rule cel = 1;
*/
cel?: RuleJson[];
};
/**
* Describes the message buf.validate.PredefinedRules.
* Use `create(PredefinedRulesSchema)` to create a new message.
*/
export declare const PredefinedRulesSchema: GenMessage<PredefinedRules, {
jsonType: PredefinedRulesJson;
}>;
/**
* FloatRules describes the rules applied to `float` values. These
* rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type.
*
* @generated from message buf.validate.FloatRules
*/
export type FloatRules = Message<"buf.validate.FloatRules"> & {
/**
* `const` requires the field value to exactly match the specified value. If
* the field value doesn't match, an error message is generated.
*
* ```proto
* message MyFloat {
* // value must equal 42.0
* float value = 1 [(buf.validate.field).float.const = 42.0];
* }
* ```
*
* @generated from field: optional float const = 1;
*/
const: number;
/**
* @generated from oneof buf.validate.FloatRules.less_than
*/
lessThan: {
/**
* `lt` requires the field value to be less than the specified value (field <
* value). If the field value is equal to or greater than the specified value,
* an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be less than 10.0
* float value = 1 [(buf.validate.field).float.lt = 10.0];
* }
* ```
*
* @generated from field: float lt = 2;
*/
value: number;
case: "lt";
} | {
/**
* `lte` requires the field value to be less than or equal to the specified
* value (field <= value). If the field value is greater than the specified
* value, an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be less than or equal to 10.0
* float value = 1 [(buf.validate.field).float.lte = 10.0];
* }
* ```
*
* @generated from field: float lte = 3;
*/
value: number;
case: "lte";
} | {
case: undefined;
value?: undefined;
};
/**
* @generated from oneof buf.validate.FloatRules.greater_than
*/
greaterThan: {
/**
* `gt` requires the field value to be greater than the specified value
* (exclusive). If the value of `gt` is larger than a specified `lt` or
* `lte`, the range is reversed, and the field value must be outside the
* specified range. If the field value doesn't meet the required conditions,
* an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be greater than 5.0 [float.gt]
* float value = 1 [(buf.validate.field).float.gt = 5.0];
*
* // value must be greater than 5 and less than 10.0 [float.gt_lt]
* float other_value = 2 [(buf.validate.field).float = { gt: 5.0, lt: 10.0 }];
*
* // value must be greater than 10 or less than 5.0 [float.gt_lt_exclusive]
* float another_value = 3 [(buf.validate.field).float = { gt: 10.0, lt: 5.0 }];
* }
* ```
*
* @generated from field: float gt = 4;
*/
value: number;
case: "gt";
} | {
/**
* `gte` requires the field value to be greater than or equal to the specified
* value (exclusive). If the value of `gte` is larger than a specified `lt`
* or `lte`, the range is reversed, and the field value must be outside the
* specified range. If the field value doesn't meet the required conditions,
* an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be greater than or equal to 5.0 [float.gte]
* float value = 1 [(buf.validate.field).float.gte = 5.0];
*
* // value must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt]
* float other_value = 2 [(buf.validate.field).float = { gte: 5.0, lt: 10.0 }];
*
* // value must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive]
* float another_value = 3 [(buf.validate.field).float = { gte: 10.0, lt: 5.0 }];
* }
* ```
*
* @generated from field: float gte = 5;
*/
value: number;
case: "gte";
} | {
case: undefined;
value?: undefined;
};
/**
* `in` requires the field value to be equal to one of the specified values.
* If the field value isn't one of the specified values, an error message
* is generated.
*
* ```proto
* message MyFloat {
* // value must be in list [1.0, 2.0, 3.0]
* float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }];
* }
* ```
*
* @generated from field: repeated float in = 6;
*/
in: number[];
/**
* `in` requires the field value to not be equal to any of the specified
* values. If the field value is one of the specified values, an error
* message is generated.
*
* ```proto
* message MyFloat {
* // value must not be in list [1.0, 2.0, 3.0]
* float value = 1 [(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }];
* }
* ```
*
* @generated from field: repeated float not_in = 7;
*/
notIn: number[];
/**
* `finite` requires the field value to be finite. If the field value is
* infinite or NaN, an error message is generated.
*
* @generated from field: optional bool finite = 8;
*/
finite: boolean;
/**
* `example` specifies values that the field may have. These values SHOULD
* conform to other rules. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyFloat {
* float value = 1 [
* (buf.validate.field).float.example = 1.0,
* (buf.validate.field).float.example = inf
* ];
* }
* ```
*
* @generated from field: repeated float example = 9;
*/
example: number[];
};
/**
* FloatRules describes the rules applied to `float` values. These
* rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type.
*
* @generated from message buf.validate.FloatRules
*/
export type FloatRulesJson = {
/**
* `const` requires the field value to exactly match the specified value. If
* the field value doesn't match, an error message is generated.
*
* ```proto
* message MyFloat {
* // value must equal 42.0
* float value = 1 [(buf.validate.field).float.const = 42.0];
* }
* ```
*
* @generated from field: optional float const = 1;
*/
const?: number | "NaN" | "Infinity" | "-Infinity";
/**
* `lt` requires the field value to be less than the specified value (field <
* value). If the field value is equal to or greater than the specified value,
* an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be less than 10.0
* float value = 1 [(buf.validate.field).float.lt = 10.0];
* }
* ```
*
* @generated from field: float lt = 2;
*/
lt?: number | "NaN" | "Infinity" | "-Infinity";
/**
* `lte` requires the field value to be less than or equal to the specified
* value (field <= value). If the field value is greater than the specified
* value, an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be less than or equal to 10.0
* float value = 1 [(buf.validate.field).float.lte = 10.0];
* }
* ```
*
* @generated from field: float lte = 3;
*/
lte?: number | "NaN" | "Infinity" | "-Infinity";
/**
* `gt` requires the field value to be greater than the specified value
* (exclusive). If the value of `gt` is larger than a specified `lt` or
* `lte`, the range is reversed, and the field value must be outside the
* specified range. If the field value doesn't meet the required conditions,
* an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be greater than 5.0 [float.gt]
* float value = 1 [(buf.validate.field).float.gt = 5.0];
*
* // value must be greater than 5 and less than 10.0 [float.gt_lt]
* float other_value = 2 [(buf.validate.field).float = { gt: 5.0, lt: 10.0 }];
*
* // value must be greater than 10 or less than 5.0 [float.gt_lt_exclusive]
* float another_value = 3 [(buf.validate.field).float = { gt: 10.0, lt: 5.0 }];
* }
* ```
*
* @generated from field: float gt = 4;
*/
gt?: number | "NaN" | "Infinity" | "-Infinity";
/**
* `gte` requires the field value to be greater than or equal to the specified
* value (exclusive). If the value of `gte` is larger than a specified `lt`
* or `lte`, the range is reversed, and the field value must be outside the
* specified range. If the field value doesn't meet the required conditions,
* an error message is generated.
*
* ```proto
* message MyFloat {
* // value must be greater than or equal to 5.0 [float.gte]
* float value = 1 [(buf.validate.field).float.gte = 5.0];
*
* // value must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt]
* float other_value = 2 [(buf.validate.field).float = { gte: 5.0, lt: 10.0 }];
*
* // value must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive]
* float another_value = 3 [(buf.validate.field).float = { gte: 10.0, lt: 5.0 }];
* }
* ```
*
* @generated from field: float gte = 5;
*/
gte?: number | "NaN" | "Infinity" | "-Infinity";
/**
* `in` requires the field value to be equal to one of the specified values.
* If the field value isn't one of the specified values, an error message
* is generated.
*
* ```proto
* message MyFloat {
* // value must be in list [1.0, 2.0, 3.0]
* float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }];
* }
* ```
*
* @generated from field: repeated float in = 6;
*/
in?: (number | "NaN" | "Infinity" | "-Infinity")[];
/**
* `in` requires the field value to not be equal to any of the specified
* values. If the field value is one of the specified values, an error
* message is generated.
*
* ```proto
* message MyFloat {
* // value must not be in list [1.0, 2.0, 3.0]
* float value = 1 [(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }];
* }
* ```
*
* @generated from field: repeated float not_in = 7;
*/
notIn?: (number | "NaN" | "Infinity" | "-Infinity")[];
/**
* `finite` requires the field value to be finite. If the field value is
* infinite or NaN, an error message is generated.
*
* @generated from field: optional bool finite = 8;
*/
finite?: boolean;
/**
* `example` specifies values that the field may have. These values SHOULD
* conform to other rules. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyFloat {
* float value = 1 [
* (buf.validate.field).float.example = 1.0,
* (buf.validate.field).float.example = inf
* ];
* }
* ```
*
* @generated from field: repeated float example = 9;
*/
example?: (number | "NaN" | "Infinity" | "-Infinity")[];
};
/**
* Describes the message buf.validate.FloatRules.
* Use `create(FloatRulesSchema)` to create a new message.
*/
export declare const FloatRulesSchema: GenMessage<FloatRules, {
jsonType: FloatRulesJson;
}>;
/**
* DoubleRules describes the rules applied to `double` values. These
* rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type.
*
* @generated from message buf.validate.DoubleRules
*/
export type DoubleRules = Message<"buf.validate.DoubleRules"> & {
/**
* `const` requires the field value to exactly match the specified value. If
* the field value doesn't match, an error message is generated.
*
* ```proto
* message MyDouble {
* // value must equal 42.0
* double value = 1 [(buf.validate.field).double.const = 42.0];
* }
* ```
*
* @generated from field: optional double const = 1;
*/
const: number;
/**
* @generated from oneof buf.validate.DoubleRules.less_than
*/
lessThan: {
/**
* `lt` requires the field value to be less than the specified value (field <
* value). If the field value is equal to or greater than the specified
* value, an error message is generated.
*
* ```proto
* message MyDouble {
* // value must be less than 10.0
* double value = 1 [(buf.validate.field).double.lt = 10.0];
* }
* ```
*
* @generated from field: double lt = 2;
*/
value: number;
case: "lt";
} | {
/**
* `lte` requires the field value to be less than or equal to the specified value
* (field <= value). If the field value is greater than the specified value,
* an error message is generated.
*
* ```proto
* message MyDouble {
* // value must be less than or equal to 10.0
* double value = 1 [(buf.validate.field).double.lte = 10.0];
* }
* ```
*
* @generated from field: double lte = 3;
*/
value: number;
case: "lte";
} | {
case: undefined;
value?: undefined;
};
/**
* @generated from oneof buf.validate.DoubleRules.greater_than
*/
greaterThan: {
/**
* `gt` requires the field value to be greater than the specified value
* (exclusive). If the value of `gt` is larger than a specified `lt` or `lte`,
* the range is reversed, and the field value must be outside the specified
* range. If the field value doesn't meet the required conditions, an error
* message is generated.
*
* ```proto
* message MyDouble {
* // value must be greater than 5.0 [double.gt]
* double value = 1 [(buf.validate.field).double.gt = 5.0];
*
* // value must be greater than 5 and less than 10.0 [double.gt_lt]
* double other_value = 2 [(buf.validate.field).double = { gt: 5.0, lt: 10.0 }];
*
* // value must be greater than 10 or less than 5.0 [double.gt_lt_exclusive]
* double another_value = 3 [(buf.validate.field).double = { gt: 10.0, lt: 5.0 }];
* }
* ```
*
* @generated from field: double gt = 4;
*/
value: number;
case: "gt";
} | {
/**
* `gte` requires the field value to be greater than or equal to the specified
* value (exclusive). If the value of `gte` is larger than a specified `lt` or
* `lte`, the range is reversed, and the field value must be outside the
* specified range. If the field value doesn't meet the required conditions,
* an error message is generated.
*
* ```proto
* message MyDouble {
* // value must be greater than or equal to 5.0 [double.gte]
* double value = 1 [(buf.validate.field).double.gte = 5.0];
*
* // value must be greater than or equal to 5.0 and less than 10.0 [double.gte_lt]
* double other_value = 2 [(buf.validate.field).double = { gte: 5.0, lt: 10.0 }];
*
* // value must be greater than or equal to 10.0 or less than 5.0 [double.gte_lt_exclusive]
* double another_value = 3 [(buf.validate.field).double = { gte: 10.0, lt: 5.0 }];
* }
* ```
*
* @generated from field: double gte = 5;
*/
value: number;
case: "gte";
} | {
case: undefined;
value?: undefined;
};
/**
* `in` requires the field value to be equal to one of the specified values.
* If the field value isn't one of the specified values, an error message is
* generated.
*
* ```proto
* message MyDouble {
* // value must be in list [1.0, 2.0, 3.0]
* double value = 1 [(buf.validate.field).double = { in: [1.0, 2.0, 3.0] }];
* }
* ```
*
* @generated from field: repeated double in = 6;
*/
in: number[];
/**
* `not_in` requires the field value to not be equal to any of the specified
* values. If the field value is one of the specified values, an error
* message is generated.
*
* ```proto
* message MyDouble {
* // value must not be in list [1.0, 2.0, 3.0]
* double value = 1 [(buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] }];
* }
* ```
*
* @generated from field: repeated double not_in = 7;
*/
notIn: number[];
/**
* `finite` requires the field value to be finite. If the field value is
* infinite or NaN, an error message is generated.
*
* @generated from field: optional bool finite = 8;
*/
finite: boolean;
/**
* `example` specifies values that the field may have. These values SHOULD
* conform to other rules. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyDouble {
* double value = 1 [
* (buf.validate.field).double.example = 1.0,
* (buf.validate.field).double.example = inf
* ];
* }
* ```
*
* @generated from field: repeated double example = 9;
*/
example: number[];
};
/**
* DoubleRules describes the rules applied to `double` values. These
* rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type.
*
* @generated from message buf.validate.DoubleRules
*/
export type DoubleRulesJson = {
/**
* `const` requires the field value to exactly match the specified value. If
* the field value doesn't match, an error message is generated.
*
* ```proto
* message MyDouble {
* // value must equal 42.0
* double value = 1 [(buf.validate.field).double.const = 42.0];
* }
* ```
*
* @generated from field: optional double const = 1;
*/
const?: number | "NaN" | "Infinity" | "-Infinity";
/**
* `lt` requires the field value to be less than the specified value (field <
* value). If the field value is equal to or greater than the specified
* value, an error message is generated.
*
* ```proto
* message MyDouble {
* // value must be less than 10.0
* double value = 1 [(buf.validate.field).double.lt = 10.0];
* }
* ```
*
* @generated from field: double lt = 2;
*/
lt?: number | "NaN" | "Infinity" | "-Infinity";
/**
* `lte` requires the field value to be less than or equal to the specified value
* (field <= value). If the field value is greater than the specified value,
* an error message is generated.
*
* ```proto
* message MyDouble {
* // value must be less than or equal to 10.0
* double value = 1 [(buf.validate.field).double.lte