@mochabug/adapt-plugin-builder
Version:
This encapsulate the building an bundling logic for mochabug adapt plugins
1,420 lines • 290 kB
TypeScript
import type { GenEnum, GenExtension, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
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;
/**
* `Constraint` represents a validation rule written in the Common Expression
* Language (CEL) syntax. Each Constraint includes a unique identifier, an
* optional error message, and the CEL expression to evaluate. For more
* information on CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
* ```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.Constraint
*/
export type Constraint = Message<"buf.validate.Constraint"> & {
/**
* `id` is a string that serves as a machine-readable name for this Constraint.
* 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 Constraint 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;
};
/**
* `Constraint` represents a validation rule written in the Common Expression
* Language (CEL) syntax. Each Constraint includes a unique identifier, an
* optional error message, and the CEL expression to evaluate. For more
* information on CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
* ```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.Constraint
*/
export type ConstraintJson = {
/**
* `id` is a string that serves as a machine-readable name for this Constraint.
* 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 Constraint 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.Constraint.
* Use `create(ConstraintSchema)` to create a new message.
*/
export declare const ConstraintSchema: GenMessage<Constraint, ConstraintJson>;
/**
* MessageConstraints represents validation rules that are applied to the entire message.
* It includes disabling options and a list of Constraint messages representing Common Expression Language (CEL) validation rules.
*
* @generated from message buf.validate.MessageConstraints
*/
export type MessageConstraints = Message<"buf.validate.MessageConstraints"> & {
/**
* `disabled` is a boolean flag that, when set to true, nullifies any validation rules for this message.
* This includes any fields within the message that would otherwise support validation.
*
* ```proto
* message MyMessage {
* // validation will be bypassed for this message
* option (buf.validate.message).disabled = true;
* }
* ```
*
* @generated from field: optional bool disabled = 1;
*/
disabled: boolean;
/**
* `cel` is a repeated field of type Constraint. Each Constraint specifies a validation rule to be applied to this message.
* These constraints are written in Common Expression Language (CEL) syntax. For more information on
* CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
*
* ```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.Constraint cel = 3;
*/
cel: Constraint[];
};
/**
* MessageConstraints represents validation rules that are applied to the entire message.
* It includes disabling options and a list of Constraint messages representing Common Expression Language (CEL) validation rules.
*
* @generated from message buf.validate.MessageConstraints
*/
export type MessageConstraintsJson = {
/**
* `disabled` is a boolean flag that, when set to true, nullifies any validation rules for this message.
* This includes any fields within the message that would otherwise support validation.
*
* ```proto
* message MyMessage {
* // validation will be bypassed for this message
* option (buf.validate.message).disabled = true;
* }
* ```
*
* @generated from field: optional bool disabled = 1;
*/
disabled?: boolean;
/**
* `cel` is a repeated field of type Constraint. Each Constraint specifies a validation rule to be applied to this message.
* These constraints are written in Common Expression Language (CEL) syntax. For more information on
* CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
*
* ```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.Constraint cel = 3;
*/
cel?: ConstraintJson[];
};
/**
* Describes the message buf.validate.MessageConstraints.
* Use `create(MessageConstraintsSchema)` to create a new message.
*/
export declare const MessageConstraintsSchema: GenMessage<MessageConstraints, MessageConstraintsJson>;
/**
* The `OneofConstraints` message type enables you to manage constraints for
* oneof fields in your protobuf messages.
*
* @generated from message buf.validate.OneofConstraints
*/
export type OneofConstraints = Message<"buf.validate.OneofConstraints"> & {
/**
* If `required` is true, exactly one field of the oneof must be present. A
* validation error is returned if no fields in the oneof are present. The
* field itself may still be a default value; further constraints
* 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 `OneofConstraints` message type enables you to manage constraints for
* oneof fields in your protobuf messages.
*
* @generated from message buf.validate.OneofConstraints
*/
export type OneofConstraintsJson = {
/**
* If `required` is true, exactly one field of the oneof must be present. A
* validation error is returned if no fields in the oneof are present. The
* field itself may still be a default value; further constraints
* 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.OneofConstraints.
* Use `create(OneofConstraintsSchema)` to create a new message.
*/
export declare const OneofConstraintsSchema: GenMessage<OneofConstraints, OneofConstraintsJson>;
/**
* FieldConstraints 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.FieldConstraints
*/
export type FieldConstraints = Message<"buf.validate.FieldConstraints"> & {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information on
* CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
* ```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.Constraint cel = 23;
*/
cel: Constraint[];
/**
* If `required` is true, the field must be populated. A populated field can be
* described as "serialized in the wire format," which includes:
*
* - the following "nullable" fields must be explicitly set to be considered populated:
* - singular message fields (whose fields may be unpopulated/default values)
* - member fields of a oneof (may be their default value)
* - proto3 optional fields (may be their default value)
* - proto2 scalar fields (both optional and required)
* - proto3 scalar fields must be non-zero to be considered populated
* - repeated and map fields must be non-empty to be considered populated
*
* ```proto
* message MyMessage {
* // The field `value` must be set to a non-null value.
* optional MyOtherMessage value = 1 [(buf.validate.field).required = true];
* }
* ```
*
* @generated from field: optional bool required = 25;
*/
required: boolean;
/**
* Skip validation on the field if its value matches the specified criteria.
* See Ignore enum for details.
*
* ```proto
* message UpdateRequest {
* // The uri rule only applies if the field is populated and not an empty
* // string.
* optional string url = 1 [
* (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE,
* (buf.validate.field).string.uri = true,
* ];
* }
* ```
*
* @generated from field: optional buf.validate.Ignore ignore = 27;
*/
ignore: Ignore;
/**
* @generated from oneof buf.validate.FieldConstraints.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;
};
};
/**
* FieldConstraints 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.FieldConstraints
*/
export type FieldConstraintsJson = {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information on
* CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
* ```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.Constraint cel = 23;
*/
cel?: ConstraintJson[];
/**
* If `required` is true, the field must be populated. A populated field can be
* described as "serialized in the wire format," which includes:
*
* - the following "nullable" fields must be explicitly set to be considered populated:
* - singular message fields (whose fields may be unpopulated/default values)
* - member fields of a oneof (may be their default value)
* - proto3 optional fields (may be their default value)
* - proto2 scalar fields (both optional and required)
* - proto3 scalar fields must be non-zero to be considered populated
* - repeated and map fields must be non-empty to be considered populated
*
* ```proto
* message MyMessage {
* // The field `value` must be set to a non-null value.
* optional MyOtherMessage value = 1 [(buf.validate.field).required = true];
* }
* ```
*
* @generated from field: optional bool required = 25;
*/
required?: boolean;
/**
* Skip validation on the field if its value matches the specified criteria.
* See Ignore enum for details.
*
* ```proto
* message UpdateRequest {
* // The uri rule only applies if the field is populated and not an empty
* // string.
* optional string url = 1 [
* (buf.validate.field).ignore = IGNORE_IF_DEFAULT_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.FieldConstraints.
* Use `create(FieldConstraintsSchema)` to create a new message.
*/
export declare const FieldConstraintsSchema: GenMessage<FieldConstraints, FieldConstraintsJson>;
/**
* PredefinedConstraints are custom constraints that can be re-used with
* multiple fields.
*
* @generated from message buf.validate.PredefinedConstraints
*/
export type PredefinedConstraints = Message<"buf.validate.PredefinedConstraints"> & {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information on
* CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
* ```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.Constraint cel = 1;
*/
cel: Constraint[];
};
/**
* PredefinedConstraints are custom constraints that can be re-used with
* multiple fields.
*
* @generated from message buf.validate.PredefinedConstraints
*/
export type PredefinedConstraintsJson = {
/**
* `cel` is a repeated field used to represent a textual expression
* in the Common Expression Language (CEL) syntax. For more information on
* CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
*
* ```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.Constraint cel = 1;
*/
cel?: ConstraintJson[];
};
/**
* Describes the message buf.validate.PredefinedConstraints.
* Use `create(PredefinedConstraintsSchema)` to create a new message.
*/
export declare const PredefinedConstraintsSchema: GenMessage<PredefinedConstraints, PredefinedConstraintsJson>;
/**
* FloatRules describes the constraints 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 constraints. `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 = "Infinity"
* ];
* }
* ```
*
* @generated from field: repeated float example = 9;
*/
example: number[];
};
/**
* FloatRules describes the constraints 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 constraints. `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 = "Infinity"
* ];
* }
* ```
*
* @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, FloatRulesJson>;
/**
* DoubleRules describes the constraints 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 constraints. `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 = "Infinity"
* ];
* }
* ```
*
* @generated from field: repeated double example = 9;
*/
example: number[];
};
/**
* DoubleRules describes the constraints 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 = 10.0];
* }
* ```
*
* @generated from field: double 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 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;
*/
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 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;
*/
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 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 | "NaN" | "Infinity" | "-Infinity")[];
/**
* `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 | "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 constraints. `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 = "Infinity"
* ];
* }
* ```
*
* @generated from field: repeated double example = 9;
*/
example?: (number | "NaN" | "Infinity" | "-Infinity")[];
};
/**
* Describes the message buf.validate.DoubleRules.
* Use `create(DoubleRulesSchema)` to create a new message.
*/
export declare const DoubleRulesSchema: GenMessage<DoubleRules, DoubleRulesJson>;
/**
* Int32Rules describes the constraints applied to `int32` values. These
* rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type.
*
* @generated from message buf.validate.Int32Rules
*/
export type Int32Rules = Message<"buf.validate.Int32Rules"> & {
/**
* `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 MyInt32 {
* // value must equal 42
* int32 value = 1 [(buf.validate.field).int32.const = 42];
* }
* ```
*
* @generated from field: optional int32 const = 1;
*/
const: number;
/**
* @generated from oneof buf.validate.Int32Rules.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 MyInt32 {
* // value must be less than 10
* int32 value = 1 [(buf.validate.field).int32.lt = 10];
* }
* ```
*
* @generated from field: int32 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 MyInt32 {
* // value must be less than or equal to 10
* int32 value = 1 [(buf.validate.field).int32.lte = 10];
* }
* ```
*
* @generated from field: int32 lte = 3;
*/
value: number;
case: "lte";
} | {
case: undefined;
value?: undefined;
};
/**
* @generated from oneof buf.validate.Int32Rules.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 val