import { Long, unknownFieldsSymbol } from "../../../runtime/protos/index.js"; import type { Dayjs, Duration, MessageFns, EnumInstance, EnumClass } from "../../../runtime/protos/index.js"; import { customJson } from "../../../runtime/util/logging.js"; import { FieldDescriptorProto_Type } from "../../google/protobuf/index.js"; /** * Specifies how `FieldRules.ignore` behaves, depending on the field's value, and * whether the field tracks presence. * */ export type Ignore = EnumInstance<"UNRECOGNIZED" | "IGNORE_UNSPECIFIED" | "IGNORE_IF_ZERO_VALUE" | "IGNORE_ALWAYS">; /** Defines the static values of {@link Ignore}. */ export interface IgnoreValueMembers { /** * Ignore rules if the field tracks presence and is unset. This is the default * behavior. * * In proto3, only message fields, members of a Protobuf `oneof`, and fields * with the `optional` label track presence. Consequently, the following fields * are always validated, whether a value is set or not: * * ```proto * syntax="proto3"; * * message RulesApply { * string email = 1 [ * (buf.validate.field).string.email = true * ]; * int32 age = 2 [ * (buf.validate.field).int32.gt = 0 * ]; * repeated string labels = 3 [ * (buf.validate.field).repeated.min_items = 1 * ]; * } * ``` * * In contrast, the following fields track presence, and are only validated if * a value is set: * * ```proto * syntax="proto3"; * * message RulesApplyIfSet { * optional string email = 1 [ * (buf.validate.field).string.email = true * ]; * oneof ref { * string reference = 2 [ * (buf.validate.field).string.uuid = true * ]; * string name = 3 [ * (buf.validate.field).string.min_len = 4 * ]; * } * SomeMessage msg = 4 [ * (buf.validate.field).cel = {/* ... * /} * ]; * } * ``` * * To ensure that such a field is set, add the `required` rule. * * To learn which fields track presence, see the * [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). * */ readonly IGNORE_UNSPECIFIED: EnumInstance<"UNRECOGNIZED" | "IGNORE_UNSPECIFIED" | "IGNORE_IF_ZERO_VALUE" | "IGNORE_ALWAYS">; /** * Ignore rules if the field is unset, or set to the zero value. * * The zero value depends on the field type: * - For strings, the zero value is the empty string. * - For bytes, the zero value is empty bytes. * - For bool, the zero value is false. * - For numeric types, the zero value is zero. * - For enums, the zero value is the first defined enum value. * - For repeated fields, the zero is an empty list. * - For map fields, the zero is an empty map. * - For message fields, absence of the message (typically a null-value) is considered zero value. * * For fields that track presence (e.g. adding the `optional` label in proto3), * this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`. * */ readonly IGNORE_IF_ZERO_VALUE: EnumInstance<"UNRECOGNIZED" | "IGNORE_UNSPECIFIED" | "IGNORE_IF_ZERO_VALUE" | "IGNORE_ALWAYS">; /** * Always ignore rules, including the `required` rule. * * This is useful for ignoring the rules of a referenced message, or to * temporarily ignore rules during development. * * ```proto * message MyMessage { * // The field's rules will always be ignored, including any validations * // on value's fields. * MyOtherMessage value = 1 [ * (buf.validate.field).ignore = IGNORE_ALWAYS * ]; * } * ``` * */ readonly IGNORE_ALWAYS: EnumInstance<"UNRECOGNIZED" | "IGNORE_UNSPECIFIED" | "IGNORE_IF_ZERO_VALUE" | "IGNORE_ALWAYS">; } /** Defines the runtime API for {@link Ignore}. */ export type IgnoreClass = EnumClass<"UNRECOGNIZED" | "IGNORE_UNSPECIFIED" | "IGNORE_IF_ZERO_VALUE" | "IGNORE_ALWAYS"> & IgnoreValueMembers; /** Converts and creates {@link Ignore} values. */ export declare const Ignore: IgnoreClass; /** * KnownRegex contains some well-known patterns. * */ export type KnownRegex = EnumInstance<"UNRECOGNIZED" | "KNOWN_REGEX_UNSPECIFIED" | "KNOWN_REGEX_HTTP_HEADER_NAME" | "KNOWN_REGEX_HTTP_HEADER_VALUE">; /** Defines the static values of {@link KnownRegex}. */ export interface KnownRegexValueMembers { /** * Represents the `KNOWN_REGEX_UNSPECIFIED` protobuf enum value. */ readonly KNOWN_REGEX_UNSPECIFIED: EnumInstance<"UNRECOGNIZED" | "KNOWN_REGEX_UNSPECIFIED" | "KNOWN_REGEX_HTTP_HEADER_NAME" | "KNOWN_REGEX_HTTP_HEADER_VALUE">; /** * HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2). * */ readonly KNOWN_REGEX_HTTP_HEADER_NAME: EnumInstance<"UNRECOGNIZED" | "KNOWN_REGEX_UNSPECIFIED" | "KNOWN_REGEX_HTTP_HEADER_NAME" | "KNOWN_REGEX_HTTP_HEADER_VALUE">; /** * HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4). * */ readonly KNOWN_REGEX_HTTP_HEADER_VALUE: EnumInstance<"UNRECOGNIZED" | "KNOWN_REGEX_UNSPECIFIED" | "KNOWN_REGEX_HTTP_HEADER_NAME" | "KNOWN_REGEX_HTTP_HEADER_VALUE">; } /** Defines the runtime API for {@link KnownRegex}. */ export type KnownRegexClass = EnumClass<"UNRECOGNIZED" | "KNOWN_REGEX_UNSPECIFIED" | "KNOWN_REGEX_HTTP_HEADER_NAME" | "KNOWN_REGEX_HTTP_HEADER_VALUE"> & KnownRegexValueMembers; /** Converts and creates {@link KnownRegex} values. */ export declare const KnownRegex: KnownRegexClass; /** * `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; * } * ``` * */ export interface Rule { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.Rule"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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. * */ id?: string | undefined; /** * `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. * */ message?: string | undefined; /** * `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. * */ expression?: string | undefined; } /** Encodes, decodes, converts, and creates {@link Rule} messages. */ export declare const Rule: MessageFns; /** * 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. * */ export interface MessageRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.MessageRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation * rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. * * This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for * simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will * be same as the `expression`. * * 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_expression = "this.foo > 42"; * // The field `foo` must be less than 84. * option (buf.validate.message).cel_expression = "this.foo < 84"; * optional int32 foo = 1; * } * ``` * */ celExpression: string[]; /** * `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; * } * ``` * */ 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; * } * ``` * */ oneof: MessageOneofRule[]; } /** Encodes, decodes, converts, and creates {@link MessageRules} messages. */ export declare const MessageRules: MessageFns; /** Represents the `buf.validate.MessageOneofRule` protobuf message. */ export interface MessageOneofRule { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.MessageOneofRule"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * 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. * */ fields: string[]; /** * If true, one of the fields specified _must_ be set. * */ required?: boolean | undefined; } /** Encodes, decodes, converts, and creates {@link MessageOneofRule} messages. */ export declare const MessageOneofRule: MessageFns; /** * The `OneofRules` message type enables you to manage rules for * oneof fields in your protobuf messages. * */ export interface OneofRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.OneofRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * 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; * } * } * ``` * */ required?: boolean | undefined; } /** Encodes, decodes, converts, and creates {@link OneofRules} messages. */ export declare const OneofRules: MessageFns; /** * FieldRules encapsulates the rules for each type of field. Depending on * the field, the correct set should be used to ensure proper validations. * */ export interface FieldRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.FieldRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation * rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. * * This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for * simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will * be same as the `expression`. * * 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_expression = "this > 42"]; * } * ``` * */ celExpression: string[]; /** * `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", * }]; * } * ``` * */ 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. * */ required?: boolean | undefined; /** * 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 * ]; * } * ``` * */ ignore?: Ignore | undefined; /** Contains the selected value for the `type` protobuf oneof. */ type?: { $case: "float"; float: FloatRules; } | { $case: "double"; double: DoubleRules; } | { $case: "int32"; int32: Int32Rules; } | { $case: "int64"; int64: Int64Rules; } | { $case: "uint32"; uint32: UInt32Rules; } | { $case: "uint64"; uint64: UInt64Rules; } | { $case: "sint32"; sint32: SInt32Rules; } | { $case: "sint64"; sint64: SInt64Rules; } | { $case: "fixed32"; fixed32: Fixed32Rules; } | { $case: "fixed64"; fixed64: Fixed64Rules; } | { $case: "sfixed32"; sfixed32: SFixed32Rules; } | { $case: "sfixed64"; sfixed64: SFixed64Rules; } | { $case: "bool"; bool: BoolRules; } | { $case: "string"; string: StringRules; } | { $case: "bytes"; bytes: BytesRules; } | { $case: "enum"; enum: EnumRules; } | { $case: "repeated"; repeated: RepeatedRules; } | { $case: "map"; map: MapRules; } | { $case: "any"; any: AnyRules; } | { $case: "duration"; duration: DurationRules; } | { $case: "fieldMask"; fieldMask: FieldMaskRules; } | { $case: "timestamp"; timestamp: TimestampRules; } | undefined; } /** Encodes, decodes, converts, and creates {@link FieldRules} messages. */ export declare const FieldRules: MessageFns; /** * PredefinedRules are custom rules that can be re-used with * multiple fields. * */ export interface PredefinedRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.PredefinedRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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", * }]; * } * ``` * */ cel: Rule[]; } /** Encodes, decodes, converts, and creates {@link PredefinedRules} messages. */ export declare const PredefinedRules: MessageFns; /** * FloatRules describes the rules applied to `float` values. These * rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type. * */ export interface FloatRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.FloatRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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]; * } * ``` * */ const?: number | 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] }]; * } * ``` * */ 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] }]; * } * ``` * */ notIn: number[]; /** * `finite` requires the field value to be finite. If the field value is * infinite or NaN, an error message is generated. * */ finite?: boolean | undefined; /** * `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 * ]; * } * ``` * */ example: number[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: number; } | { $case: "lte"; lte: number; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: number; } | { $case: "gte"; gte: number; } | undefined; } /** Encodes, decodes, converts, and creates {@link FloatRules} messages. */ export declare const FloatRules: MessageFns; /** * DoubleRules describes the rules applied to `double` values. These * rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type. * */ export interface DoubleRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.DoubleRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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]; * } * ``` * */ const?: number | 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] }]; * } * ``` * */ 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] }]; * } * ``` * */ notIn: number[]; /** * `finite` requires the field value to be finite. If the field value is * infinite or NaN, an error message is generated. * */ finite?: boolean | undefined; /** * `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 * ]; * } * ``` * */ example: number[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: number; } | { $case: "lte"; lte: number; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: number; } | { $case: "gte"; gte: number; } | undefined; } /** Encodes, decodes, converts, and creates {@link DoubleRules} messages. */ export declare const DoubleRules: MessageFns; /** * Int32Rules describes the rules applied to `int32` values. These * rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type. * */ export interface Int32Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.Int32Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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]; * } * ``` * */ const?: number | 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 MyInt32 { * // value must be in list [1, 2, 3] * int32 value = 1 [(buf.validate.field).int32 = { in: [1, 2, 3] }]; * } * ``` * */ 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 MyInt32 { * // value must not be in list [1, 2, 3] * int32 value = 1 [(buf.validate.field).int32 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: number[]; /** * `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 MyInt32 { * int32 value = 1 [ * (buf.validate.field).int32.example = 1, * (buf.validate.field).int32.example = -10 * ]; * } * ``` * */ example: number[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: number; } | { $case: "lte"; lte: number; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: number; } | { $case: "gte"; gte: number; } | undefined; } /** Encodes, decodes, converts, and creates {@link Int32Rules} messages. */ export declare const Int32Rules: MessageFns; /** * Int64Rules describes the rules applied to `int64` values. These * rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type. * */ export interface Int64Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.Int64Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MyInt64 { * // value must equal 42 * int64 value = 1 [(buf.validate.field).int64.const = 42]; * } * ``` * */ const?: Long | 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 MyInt64 { * // value must be in list [1, 2, 3] * int64 value = 1 [(buf.validate.field).int64 = { in: [1, 2, 3] }]; * } * ``` * */ in: Long[]; /** * `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 MyInt64 { * // value must not be in list [1, 2, 3] * int64 value = 1 [(buf.validate.field).int64 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: Long[]; /** * `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 MyInt64 { * int64 value = 1 [ * (buf.validate.field).int64.example = 1, * (buf.validate.field).int64.example = -10 * ]; * } * ``` * */ example: Long[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: Long; } | { $case: "lte"; lte: Long; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: Long; } | { $case: "gte"; gte: Long; } | undefined; } /** Encodes, decodes, converts, and creates {@link Int64Rules} messages. */ export declare const Int64Rules: MessageFns; /** * UInt32Rules describes the rules applied to `uint32` values. These * rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type. * */ export interface UInt32Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.UInt32Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MyUInt32 { * // value must equal 42 * uint32 value = 1 [(buf.validate.field).uint32.const = 42]; * } * ``` * */ const?: number | 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 MyUInt32 { * // value must be in list [1, 2, 3] * uint32 value = 1 [(buf.validate.field).uint32 = { in: [1, 2, 3] }]; * } * ``` * */ 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 MyUInt32 { * // value must not be in list [1, 2, 3] * uint32 value = 1 [(buf.validate.field).uint32 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: number[]; /** * `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 MyUInt32 { * uint32 value = 1 [ * (buf.validate.field).uint32.example = 1, * (buf.validate.field).uint32.example = 10 * ]; * } * ``` * */ example: number[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: number; } | { $case: "lte"; lte: number; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: number; } | { $case: "gte"; gte: number; } | undefined; } /** Encodes, decodes, converts, and creates {@link UInt32Rules} messages. */ export declare const UInt32Rules: MessageFns; /** * UInt64Rules describes the rules applied to `uint64` values. These * rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type. * */ export interface UInt64Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.UInt64Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MyUInt64 { * // value must equal 42 * uint64 value = 1 [(buf.validate.field).uint64.const = 42]; * } * ``` * */ const?: Long | 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 MyUInt64 { * // value must be in list [1, 2, 3] * uint64 value = 1 [(buf.validate.field).uint64 = { in: [1, 2, 3] }]; * } * ``` * */ in: Long[]; /** * `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 MyUInt64 { * // value must not be in list [1, 2, 3] * uint64 value = 1 [(buf.validate.field).uint64 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: Long[]; /** * `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 MyUInt64 { * uint64 value = 1 [ * (buf.validate.field).uint64.example = 1, * (buf.validate.field).uint64.example = -10 * ]; * } * ``` * */ example: Long[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: Long; } | { $case: "lte"; lte: Long; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: Long; } | { $case: "gte"; gte: Long; } | undefined; } /** Encodes, decodes, converts, and creates {@link UInt64Rules} messages. */ export declare const UInt64Rules: MessageFns; /** * SInt32Rules describes the rules applied to `sint32` values. * */ export interface SInt32Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.SInt32Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MySInt32 { * // value must equal 42 * sint32 value = 1 [(buf.validate.field).sint32.const = 42]; * } * ``` * */ const?: number | 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 MySInt32 { * // value must be in list [1, 2, 3] * sint32 value = 1 [(buf.validate.field).sint32 = { in: [1, 2, 3] }]; * } * ``` * */ 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 MySInt32 { * // value must not be in list [1, 2, 3] * sint32 value = 1 [(buf.validate.field).sint32 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: number[]; /** * `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 MySInt32 { * sint32 value = 1 [ * (buf.validate.field).sint32.example = 1, * (buf.validate.field).sint32.example = -10 * ]; * } * ``` * */ example: number[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: number; } | { $case: "lte"; lte: number; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: number; } | { $case: "gte"; gte: number; } | undefined; } /** Encodes, decodes, converts, and creates {@link SInt32Rules} messages. */ export declare const SInt32Rules: MessageFns; /** * SInt64Rules describes the rules applied to `sint64` values. * */ export interface SInt64Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.SInt64Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MySInt64 { * // value must equal 42 * sint64 value = 1 [(buf.validate.field).sint64.const = 42]; * } * ``` * */ const?: Long | 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 MySInt64 { * // value must be in list [1, 2, 3] * sint64 value = 1 [(buf.validate.field).sint64 = { in: [1, 2, 3] }]; * } * ``` * */ in: Long[]; /** * `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 MySInt64 { * // value must not be in list [1, 2, 3] * sint64 value = 1 [(buf.validate.field).sint64 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: Long[]; /** * `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 MySInt64 { * sint64 value = 1 [ * (buf.validate.field).sint64.example = 1, * (buf.validate.field).sint64.example = -10 * ]; * } * ``` * */ example: Long[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: Long; } | { $case: "lte"; lte: Long; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: Long; } | { $case: "gte"; gte: Long; } | undefined; } /** Encodes, decodes, converts, and creates {@link SInt64Rules} messages. */ export declare const SInt64Rules: MessageFns; /** * Fixed32Rules describes the rules applied to `fixed32` values. * */ export interface Fixed32Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.Fixed32Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MyFixed32 { * // value must equal 42 * fixed32 value = 1 [(buf.validate.field).fixed32.const = 42]; * } * ``` * */ const?: number | 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 MyFixed32 { * // value must be in list [1, 2, 3] * fixed32 value = 1 [(buf.validate.field).fixed32 = { in: [1, 2, 3] }]; * } * ``` * */ 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 MyFixed32 { * // value must not be in list [1, 2, 3] * fixed32 value = 1 [(buf.validate.field).fixed32 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: number[]; /** * `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 MyFixed32 { * fixed32 value = 1 [ * (buf.validate.field).fixed32.example = 1, * (buf.validate.field).fixed32.example = 2 * ]; * } * ``` * */ example: number[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: number; } | { $case: "lte"; lte: number; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: number; } | { $case: "gte"; gte: number; } | undefined; } /** Encodes, decodes, converts, and creates {@link Fixed32Rules} messages. */ export declare const Fixed32Rules: MessageFns; /** * Fixed64Rules describes the rules applied to `fixed64` values. * */ export interface Fixed64Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.Fixed64Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MyFixed64 { * // value must equal 42 * fixed64 value = 1 [(buf.validate.field).fixed64.const = 42]; * } * ``` * */ const?: Long | 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 MyFixed64 { * // value must be in list [1, 2, 3] * fixed64 value = 1 [(buf.validate.field).fixed64 = { in: [1, 2, 3] }]; * } * ``` * */ in: Long[]; /** * `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 MyFixed64 { * // value must not be in list [1, 2, 3] * fixed64 value = 1 [(buf.validate.field).fixed64 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: Long[]; /** * `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 MyFixed64 { * fixed64 value = 1 [ * (buf.validate.field).fixed64.example = 1, * (buf.validate.field).fixed64.example = 2 * ]; * } * ``` * */ example: Long[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: Long; } | { $case: "lte"; lte: Long; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: Long; } | { $case: "gte"; gte: Long; } | undefined; } /** Encodes, decodes, converts, and creates {@link Fixed64Rules} messages. */ export declare const Fixed64Rules: MessageFns; /** * SFixed32Rules describes the rules applied to `fixed32` values. * */ export interface SFixed32Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.SFixed32Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MySFixed32 { * // value must equal 42 * sfixed32 value = 1 [(buf.validate.field).sfixed32.const = 42]; * } * ``` * */ const?: number | 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 MySFixed32 { * // value must be in list [1, 2, 3] * sfixed32 value = 1 [(buf.validate.field).sfixed32 = { in: [1, 2, 3] }]; * } * ``` * */ 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 MySFixed32 { * // value must not be in list [1, 2, 3] * sfixed32 value = 1 [(buf.validate.field).sfixed32 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: number[]; /** * `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 MySFixed32 { * sfixed32 value = 1 [ * (buf.validate.field).sfixed32.example = 1, * (buf.validate.field).sfixed32.example = 2 * ]; * } * ``` * */ example: number[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: number; } | { $case: "lte"; lte: number; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: number; } | { $case: "gte"; gte: number; } | undefined; } /** Encodes, decodes, converts, and creates {@link SFixed32Rules} messages. */ export declare const SFixed32Rules: MessageFns; /** * SFixed64Rules describes the rules applied to `fixed64` values. * */ export interface SFixed64Rules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.SFixed64Rules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MySFixed64 { * // value must equal 42 * sfixed64 value = 1 [(buf.validate.field).sfixed64.const = 42]; * } * ``` * */ const?: Long | 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 MySFixed64 { * // value must be in list [1, 2, 3] * sfixed64 value = 1 [(buf.validate.field).sfixed64 = { in: [1, 2, 3] }]; * } * ``` * */ in: Long[]; /** * `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 MySFixed64 { * // value must not be in list [1, 2, 3] * sfixed64 value = 1 [(buf.validate.field).sfixed64 = { not_in: [1, 2, 3] }]; * } * ``` * */ notIn: Long[]; /** * `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 MySFixed64 { * sfixed64 value = 1 [ * (buf.validate.field).sfixed64.example = 1, * (buf.validate.field).sfixed64.example = 2 * ]; * } * ``` * */ example: Long[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: Long; } | { $case: "lte"; lte: Long; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: Long; } | { $case: "gte"; gte: Long; } | undefined; } /** Encodes, decodes, converts, and creates {@link SFixed64Rules} messages. */ export declare const SFixed64Rules: MessageFns; /** * BoolRules describes the rules applied to `bool` values. These rules * may also be applied to the `google.protobuf.BoolValue` Well-Known-Type. * */ export interface BoolRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.BoolRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `const` requires the field value to exactly match the specified boolean value. * If the field value doesn't match, an error message is generated. * * ```proto * message MyBool { * // value must equal true * bool value = 1 [(buf.validate.field).bool.const = true]; * } * ``` * */ const?: boolean | undefined; /** * `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 MyBool { * bool value = 1 [ * (buf.validate.field).bool.example = 1, * (buf.validate.field).bool.example = 2 * ]; * } * ``` * */ example: boolean[]; } /** Encodes, decodes, converts, and creates {@link BoolRules} messages. */ export declare const BoolRules: MessageFns; /** * StringRules describes the rules applied to `string` values These * rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type. * */ export interface StringRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.StringRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `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 MyString { * // value must equal `hello` * string value = 1 [(buf.validate.field).string.const = "hello"]; * } * ``` * */ const?: string | undefined; /** * `len` dictates that the field value must have the specified * number of characters (Unicode code points), which may differ from the number * of bytes in the string. If the field value does not meet the specified * length, an error message will be generated. * * ```proto * message MyString { * // value length must be 5 characters * string value = 1 [(buf.validate.field).string.len = 5]; * } * ``` * */ len?: Long | undefined; /** * `min_len` specifies that the field value must have at least the specified * number of characters (Unicode code points), which may differ from the number * of bytes in the string. If the field value contains fewer characters, an error * message will be generated. * * ```proto * message MyString { * // value length must be at least 3 characters * string value = 1 [(buf.validate.field).string.min_len = 3]; * } * ``` * */ minLen?: Long | undefined; /** * `max_len` specifies that the field value must have no more than the specified * number of characters (Unicode code points), which may differ from the * number of bytes in the string. If the field value contains more characters, * an error message will be generated. * * ```proto * message MyString { * // value length must be at most 10 characters * string value = 1 [(buf.validate.field).string.max_len = 10]; * } * ``` * */ maxLen?: Long | undefined; /** * `len_bytes` dictates that the field value must have the specified number of * bytes. If the field value does not match the specified length in bytes, * an error message will be generated. * * ```proto * message MyString { * // value length must be 6 bytes * string value = 1 [(buf.validate.field).string.len_bytes = 6]; * } * ``` * */ lenBytes?: Long | undefined; /** * `min_bytes` specifies that the field value must have at least the specified * number of bytes. If the field value contains fewer bytes, an error message * will be generated. * * ```proto * message MyString { * // value length must be at least 4 bytes * string value = 1 [(buf.validate.field).string.min_bytes = 4]; * } * * ``` * */ minBytes?: Long | undefined; /** * `max_bytes` specifies that the field value must have no more than the * specified number of bytes. If the field value contains more bytes, an * error message will be generated. * * ```proto * message MyString { * // value length must be at most 8 bytes * string value = 1 [(buf.validate.field).string.max_bytes = 8]; * } * ``` * */ maxBytes?: Long | undefined; /** * `pattern` specifies that the field value must match the specified * regular expression (RE2 syntax), with the expression provided without any * delimiters. If the field value doesn't match the regular expression, an * error message will be generated. * * ```proto * message MyString { * // value does not match regex pattern `^[a-zA-Z]//$` * string value = 1 [(buf.validate.field).string.pattern = "^[a-zA-Z]//$"]; * } * ``` * */ pattern?: string | undefined; /** * `prefix` specifies that the field value must have the * specified substring at the beginning of the string. If the field value * doesn't start with the specified prefix, an error message will be * generated. * * ```proto * message MyString { * // value does not have prefix `pre` * string value = 1 [(buf.validate.field).string.prefix = "pre"]; * } * ``` * */ prefix?: string | undefined; /** * `suffix` specifies that the field value must have the * specified substring at the end of the string. If the field value doesn't * end with the specified suffix, an error message will be generated. * * ```proto * message MyString { * // value does not have suffix `post` * string value = 1 [(buf.validate.field).string.suffix = "post"]; * } * ``` * */ suffix?: string | undefined; /** * `contains` specifies that the field value must have the * specified substring anywhere in the string. If the field value doesn't * contain the specified substring, an error message will be generated. * * ```proto * message MyString { * // value does not contain substring `inside`. * string value = 1 [(buf.validate.field).string.contains = "inside"]; * } * ``` * */ contains?: string | undefined; /** * `not_contains` specifies that the field value must not have the * specified substring anywhere in the string. If the field value contains * the specified substring, an error message will be generated. * * ```proto * message MyString { * // value contains substring `inside`. * string value = 1 [(buf.validate.field).string.not_contains = "inside"]; * } * ``` * */ notContains?: string | undefined; /** * `in` specifies that the field value must be equal to one of the specified * values. If the field value isn't one of the specified values, an error * message will be generated. * * ```proto * message MyString { * // value must be in list ["apple", "banana"] * string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"]; * } * ``` * */ in: string[]; /** * `not_in` specifies that the field value cannot be equal to any * of the specified values. If the field value is one of the specified values, * an error message will be generated. * ```proto * message MyString { * // value must not be in list ["orange", "grape"] * string value = 1 [(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"]; * } * ``` * */ notIn: string[]; /** * This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to * enable strict header validation. By default, this is true, and HTTP header * validations are [RFC-compliant](https://datatracker.ietf.org/doc/html/rfc7230#section-3). Setting to false will enable looser * validations that only disallow `\r\n\0` characters, which can be used to * bypass header matching rules. * * ```proto * message MyString { * // The field `value` must have be a valid HTTP headers, but not enforced with strict rules. * string value = 1 [(buf.validate.field).string.strict = false]; * } * ``` * */ strict?: boolean | undefined; /** * `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 MyString { * string value = 1 [ * (buf.validate.field).string.example = "hello", * (buf.validate.field).string.example = "world" * ]; * } * ``` * */ example: string[]; /** * `WellKnown` rules provide advanced rules against common string * patterns. * */ wellKnown?: { $case: "email"; email: boolean; } | { $case: "hostname"; hostname: boolean; } | { $case: "ip"; ip: boolean; } | { $case: "ipv4"; ipv4: boolean; } | { $case: "ipv6"; ipv6: boolean; } | { $case: "uri"; uri: boolean; } | { $case: "uriRef"; uriRef: boolean; } | { $case: "address"; address: boolean; } | { $case: "uuid"; uuid: boolean; } | { $case: "tuuid"; tuuid: boolean; } | { $case: "ipWithPrefixlen"; ipWithPrefixlen: boolean; } | { $case: "ipv4WithPrefixlen"; ipv4WithPrefixlen: boolean; } | { $case: "ipv6WithPrefixlen"; ipv6WithPrefixlen: boolean; } | { $case: "ipPrefix"; ipPrefix: boolean; } | { $case: "ipv4Prefix"; ipv4Prefix: boolean; } | { $case: "ipv6Prefix"; ipv6Prefix: boolean; } | { $case: "hostAndPort"; hostAndPort: boolean; } | { $case: "ulid"; ulid: boolean; } | { $case: "wellKnownRegex"; wellKnownRegex: KnownRegex; } | undefined; } /** Encodes, decodes, converts, and creates {@link StringRules} messages. */ export declare const StringRules: MessageFns; /** * BytesRules describe the rules applied to `bytes` values. These rules * may also be applied to the `google.protobuf.BytesValue` Well-Known-Type. * */ export interface BytesRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.BytesRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `const` requires the field value to exactly match the specified bytes * value. If the field value doesn't match, an error message is generated. * * ```proto * message MyBytes { * // value must be "\x01\x02\x03\x04" * bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; * } * ``` * */ const?: Uint8Array | undefined; /** * `len` requires the field value to have the specified length in bytes. * If the field value doesn't match, an error message is generated. * * ```proto * message MyBytes { * // value length must be 4 bytes. * optional bytes value = 1 [(buf.validate.field).bytes.len = 4]; * } * ``` * */ len?: Long | undefined; /** * `min_len` requires the field value to have at least the specified minimum * length in bytes. * If the field value doesn't meet the requirement, an error message is generated. * * ```proto * message MyBytes { * // value length must be at least 2 bytes. * optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; * } * ``` * */ minLen?: Long | undefined; /** * `max_len` requires the field value to have at most the specified maximum * length in bytes. * If the field value exceeds the requirement, an error message is generated. * * ```proto * message MyBytes { * // value must be at most 6 bytes. * optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; * } * ``` * */ maxLen?: Long | undefined; /** * `pattern` requires the field value to match the specified regular * expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). * The value of the field must be valid UTF-8 or validation will fail with a * runtime error. * If the field value doesn't match the pattern, an error message is generated. * * ```proto * message MyBytes { * // value must match regex pattern "^[a-zA-Z0-9]+$". * optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; * } * ``` * */ pattern?: string | undefined; /** * `prefix` requires the field value to have the specified bytes at the * beginning of the string. * If the field value doesn't meet the requirement, an error message is generated. * * ```proto * message MyBytes { * // value does not have prefix \x01\x02 * optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"]; * } * ``` * */ prefix?: Uint8Array | undefined; /** * `suffix` requires the field value to have the specified bytes at the end * of the string. * If the field value doesn't meet the requirement, an error message is generated. * * ```proto * message MyBytes { * // value does not have suffix \x03\x04 * optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"]; * } * ``` * */ suffix?: Uint8Array | undefined; /** * `contains` requires the field value to have the specified bytes anywhere in * the string. * If the field value doesn't meet the requirement, an error message is generated. * * ```proto * message MyBytes { * // value does not contain \x02\x03 * optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"]; * } * ``` * */ contains?: Uint8Array | undefined; /** * `in` requires the field value to be equal to one of the specified * values. If the field value doesn't match any of the specified values, an * error message is generated. * * ```proto * message MyBytes { * // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] * optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; * } * ``` * */ in: Uint8Array[]; /** * `not_in` requires the field value to be not equal to any of the specified * values. * If the field value matches any of the specified values, an error message is * generated. * * ```proto * message MyBytes { * // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] * optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; * } * ``` * */ notIn: Uint8Array[]; /** * `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 MyBytes { * bytes value = 1 [ * (buf.validate.field).bytes.example = "\x01\x02", * (buf.validate.field).bytes.example = "\x02\x03" * ]; * } * ``` * */ example: Uint8Array[]; /** * WellKnown rules provide advanced rules against common byte * patterns * */ wellKnown?: { $case: "ip"; ip: boolean; } | { $case: "ipv4"; ipv4: boolean; } | { $case: "ipv6"; ipv6: boolean; } | { $case: "uuid"; uuid: boolean; } | undefined; } /** Encodes, decodes, converts, and creates {@link BytesRules} messages. */ export declare const BytesRules: MessageFns; /** * EnumRules describe the rules applied to `enum` values. * */ export interface EnumRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.EnumRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `const` requires the field value to exactly match the specified enum value. * If the field value doesn't match, an error message is generated. * * ```proto * enum MyEnum { * MY_ENUM_UNSPECIFIED = 0; * MY_ENUM_VALUE1 = 1; * MY_ENUM_VALUE2 = 2; * } * * message MyMessage { * // The field `value` must be exactly MY_ENUM_VALUE1. * MyEnum value = 1 [(buf.validate.field).enum.const = 1]; * } * ``` * */ const?: number | undefined; /** * `defined_only` requires the field value to be one of the defined values for * this enum, failing on any undefined value. * * ```proto * enum MyEnum { * MY_ENUM_UNSPECIFIED = 0; * MY_ENUM_VALUE1 = 1; * MY_ENUM_VALUE2 = 2; * } * * message MyMessage { * // The field `value` must be a defined value of MyEnum. * MyEnum value = 1 [(buf.validate.field).enum.defined_only = true]; * } * ``` * */ definedOnly?: boolean | undefined; /** * `in` requires the field value to be equal to one of the * specified enum values. If the field value doesn't match any of the * specified values, an error message is generated. * * ```proto * enum MyEnum { * MY_ENUM_UNSPECIFIED = 0; * MY_ENUM_VALUE1 = 1; * MY_ENUM_VALUE2 = 2; * } * * message MyMessage { * // The field `value` must be equal to one of the specified values. * MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}]; * } * ``` * */ in: number[]; /** * `not_in` requires the field value to be not equal to any of the * specified enum values. If the field value matches one of the specified * values, an error message is generated. * * ```proto * enum MyEnum { * MY_ENUM_UNSPECIFIED = 0; * MY_ENUM_VALUE1 = 1; * MY_ENUM_VALUE2 = 2; * } * * message MyMessage { * // The field `value` must not be equal to any of the specified values. * MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}]; * } * ``` * */ notIn: number[]; /** * `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 * enum MyEnum { * MY_ENUM_UNSPECIFIED = 0; * MY_ENUM_VALUE1 = 1; * MY_ENUM_VALUE2 = 2; * } * * message MyMessage { * (buf.validate.field).enum.example = 1, * (buf.validate.field).enum.example = 2 * } * ``` * */ example: number[]; } /** Encodes, decodes, converts, and creates {@link EnumRules} messages. */ export declare const EnumRules: MessageFns; /** * RepeatedRules describe the rules applied to `repeated` values. * */ export interface RepeatedRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.RepeatedRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `min_items` requires that this field must contain at least the specified * minimum number of items. * * Note that `min_items = 1` is equivalent to setting a field as `required`. * * ```proto * message MyRepeated { * // value must contain at least 2 items * repeated string value = 1 [(buf.validate.field).repeated.min_items = 2]; * } * ``` * */ minItems?: Long | undefined; /** * `max_items` denotes that this field must not exceed a * certain number of items as the upper limit. If the field contains more * items than specified, an error message will be generated, requiring the * field to maintain no more than the specified number of items. * * ```proto * message MyRepeated { * // value must contain no more than 3 item(s) * repeated string value = 1 [(buf.validate.field).repeated.max_items = 3]; * } * ``` * */ maxItems?: Long | undefined; /** * `unique` indicates that all elements in this field must * be unique. This rule is strictly applicable to scalar and enum * types, with message types not being supported. * * ```proto * message MyRepeated { * // repeated value must contain unique items * repeated string value = 1 [(buf.validate.field).repeated.unique = true]; * } * ``` * */ unique?: boolean | undefined; /** * `items` details the rules to be applied to each item * in the field. Even for repeated message fields, validation is executed * against each item unless `ignore` is specified. * * ```proto * message MyRepeated { * // The items in the field `value` must follow the specified rules. * repeated string value = 1 [(buf.validate.field).repeated.items = { * string: { * min_len: 3 * max_len: 10 * } * }]; * } * ``` * * Note that the `required` rule does not apply. Repeated items * cannot be unset. * */ items?: FieldRules | undefined; } /** Encodes, decodes, converts, and creates {@link RepeatedRules} messages. */ export declare const RepeatedRules: MessageFns; /** * MapRules describe the rules applied to `map` values. * */ export interface MapRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.MapRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * Specifies the minimum number of key-value pairs allowed. If the field has * fewer key-value pairs than specified, an error message is generated. * * ```proto * message MyMap { * // The field `value` must have at least 2 key-value pairs. * map value = 1 [(buf.validate.field).map.min_pairs = 2]; * } * ``` * */ minPairs?: Long | undefined; /** * Specifies the maximum number of key-value pairs allowed. If the field has * more key-value pairs than specified, an error message is generated. * * ```proto * message MyMap { * // The field `value` must have at most 3 key-value pairs. * map value = 1 [(buf.validate.field).map.max_pairs = 3]; * } * ``` * */ maxPairs?: Long | undefined; /** * Specifies the rules to be applied to each key in the field. * * ```proto * message MyMap { * // The keys in the field `value` must follow the specified rules. * map value = 1 [(buf.validate.field).map.keys = { * string: { * min_len: 3 * max_len: 10 * } * }]; * } * ``` * * Note that the `required` rule does not apply. Map keys cannot be unset. * */ keys?: FieldRules | undefined; /** * Specifies the rules to be applied to the value of each key in the * field. Message values will still have their validations evaluated unless * `ignore` is specified. * * ```proto * message MyMap { * // The values in the field `value` must follow the specified rules. * map value = 1 [(buf.validate.field).map.values = { * string: { * min_len: 5 * max_len: 20 * } * }]; * } * ``` * Note that the `required` rule does not apply. Map values cannot be unset. * */ values?: FieldRules | undefined; } /** Encodes, decodes, converts, and creates {@link MapRules} messages. */ export declare const MapRules: MessageFns; /** * AnyRules describe rules applied exclusively to the `google.protobuf.Any` well-known type. * */ export interface AnyRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.AnyRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `in` requires the field's `type_url` to be equal to one of the * specified values. If it doesn't match any of the specified values, an error * message is generated. * * ```proto * message MyAny { * // The `value` field must have a `type_url` equal to one of the specified values. * google.protobuf.Any value = 1 [(buf.validate.field).any = { * in: ["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"] * }]; * } * ``` * */ in: string[]; /** * requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated. * * ```proto * message MyAny { * // The `value` field must not have a `type_url` equal to any of the specified values. * google.protobuf.Any value = 1 [(buf.validate.field).any = { * not_in: ["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"] * }]; * } * ``` * */ notIn: string[]; } /** Encodes, decodes, converts, and creates {@link AnyRules} messages. */ export declare const AnyRules: MessageFns; /** * DurationRules describe the rules applied exclusively to the `google.protobuf.Duration` well-known type. * */ export interface DurationRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.DurationRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `const` dictates that the field must match the specified value of the `google.protobuf.Duration` type exactly. * If the field's value deviates from the specified value, an error message * will be generated. * * ```proto * message MyDuration { * // value must equal 5s * google.protobuf.Duration value = 1 [(buf.validate.field).duration.const = "5s"]; * } * ``` * */ const?: Duration | undefined; /** * `in` asserts that the field must be equal to one of the specified values of the `google.protobuf.Duration` type. * If the field's value doesn't correspond to any of the specified values, * an error message will be generated. * * ```proto * message MyDuration { * // value must be in list [1s, 2s, 3s] * google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]]; * } * ``` * */ in: Duration[]; /** * `not_in` denotes that the field must not be equal to * any of the specified values of the `google.protobuf.Duration` type. * If the field's value matches any of these values, an error message will be * generated. * * ```proto * message MyDuration { * // value must not be in list [1s, 2s, 3s] * google.protobuf.Duration value = 1 [(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]]; * } * ``` * */ notIn: Duration[]; /** * `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 MyDuration { * google.protobuf.Duration value = 1 [ * (buf.validate.field).duration.example = { seconds: 1 }, * (buf.validate.field).duration.example = { seconds: 2 }, * ]; * } * ``` * */ example: Duration[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: Duration; } | { $case: "lte"; lte: Duration; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: Duration; } | { $case: "gte"; gte: Duration; } | undefined; } /** Encodes, decodes, converts, and creates {@link DurationRules} messages. */ export declare const DurationRules: MessageFns; /** * FieldMaskRules describe rules applied exclusively to the `google.protobuf.FieldMask` well-known type. * */ export interface FieldMaskRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.FieldMaskRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `const` dictates that the field must match the specified value of the `google.protobuf.FieldMask` type exactly. * If the field's value deviates from the specified value, an error message * will be generated. * * ```proto * message MyFieldMask { * // value must equal ["a"] * google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask.const = { * paths: ["a"] * }]; * } * ``` * */ const?: string[] | undefined; /** * `in` requires the field value to only contain paths matching specified * values or their subpaths. * If any of the field value's paths doesn't match the rule, * an error message is generated. * See: https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask * * ```proto * message MyFieldMask { * // The `value` FieldMask must only contain paths listed in `in`. * google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { * in: ["a", "b", "c.a"] * }]; * } * ``` * */ in: string[]; /** * `not_in` requires the field value to not contain paths matching specified * values or their subpaths. * If any of the field value's paths matches the rule, * an error message is generated. * See: https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask * * ```proto * message MyFieldMask { * // The `value` FieldMask shall not contain paths listed in `not_in`. * google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { * not_in: ["forbidden", "immutable", "c.a"] * }]; * } * ``` * */ notIn: string[]; /** * `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 MyFieldMask { * google.protobuf.FieldMask value = 1 [ * (buf.validate.field).field_mask.example = { paths: ["a", "b"] }, * (buf.validate.field).field_mask.example = { paths: ["c.a", "d"] }, * ]; * } * ``` * */ example: string[][]; } /** Encodes, decodes, converts, and creates {@link FieldMaskRules} messages. */ export declare const FieldMaskRules: MessageFns; /** * TimestampRules describe the rules applied exclusively to the `google.protobuf.Timestamp` well-known type. * */ export interface TimestampRules { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.TimestampRules"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated. * * ```proto * message MyTimestamp { * // value must equal 2023-05-03T10:00:00Z * google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.const = {seconds: 1727998800}]; * } * ``` * */ const?: Dayjs | undefined; /** * `within` specifies that this field, of the `google.protobuf.Timestamp` type, must be within the specified duration of the current time. If the field value isn't within the duration, an error message is generated. * * ```proto * message MyTimestamp { * // value must be within 1 hour of now * google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.within = {seconds: 3600}]; * } * ``` * */ within?: Duration | undefined; /** * `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 MyTimestamp { * google.protobuf.Timestamp value = 1 [ * (buf.validate.field).timestamp.example = { seconds: 1672444800 }, * (buf.validate.field).timestamp.example = { seconds: 1672531200 }, * ]; * } * ``` * */ example: Dayjs[]; /** Contains the selected value for the `less_than` protobuf oneof. */ lessThan?: { $case: "lt"; lt: Dayjs; } | { $case: "lte"; lte: Dayjs; } | { $case: "ltNow"; ltNow: boolean; } | undefined; /** Contains the selected value for the `greater_than` protobuf oneof. */ greaterThan?: { $case: "gt"; gt: Dayjs; } | { $case: "gte"; gte: Dayjs; } | { $case: "gtNow"; gtNow: boolean; } | undefined; } /** Encodes, decodes, converts, and creates {@link TimestampRules} messages. */ export declare const TimestampRules: MessageFns; /** * `Violations` is a collection of `Violation` messages. This message type is returned by * Protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules. * Each individual violation is represented by a `Violation` message. * */ export interface Violations { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.Violations"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected. * */ violations: Violation[]; } /** Encodes, decodes, converts, and creates {@link Violations} messages. */ export declare const Violations: MessageFns; /** * `Violation` represents a single instance where a validation rule, expressed * as a `Rule`, was not met. It provides information about the field that * caused the violation, the specific rule that wasn't fulfilled, and a * human-readable error message. * * For example, consider the following message: * * ```proto * message User { * int32 age = 1 [(buf.validate.field).cel = { * id: "user.age", * expression: "this < 18 ? 'User must be at least 18 years old' : ''", * }]; * } * ``` * * It could produce the following violation: * * ```json * { * "ruleId": "user.age", * "message": "User must be at least 18 years old", * "field": { * "elements": [ * { * "fieldNumber": 1, * "fieldName": "age", * "fieldType": "TYPE_INT32" * } * ] * }, * "rule": { * "elements": [ * { * "fieldNumber": 23, * "fieldName": "cel", * "fieldType": "TYPE_MESSAGE", * "index": "0" * } * ] * } * } * ``` * */ export interface Violation { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.Violation"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `field` is a machine-readable path to the field that failed validation. * This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. * * For example, consider the following message: * * ```proto * message Message { * bool a = 1 [(buf.validate.field).required = true]; * } * ``` * * It could produce the following violation: * * ```textproto * violation { * field { element { field_number: 1, field_name: "a", field_type: 8 } } * ... * } * ``` * */ field?: FieldPath | undefined; /** * `rule` is a machine-readable path that points to the specific rule that failed validation. * This will be a nested field starting from the FieldRules of the field that failed validation. * For custom rules, this will provide the path of the rule, e.g. `cel[0]`. * * For example, consider the following message: * * ```proto * message Message { * bool a = 1 [(buf.validate.field).required = true]; * bool b = 2 [(buf.validate.field).cel = { * id: "custom_rule", * expression: "!this ? 'b must be true': ''" * }] * } * ``` * * It could produce the following violations: * * ```textproto * violation { * rule { element { field_number: 25, field_name: "required", field_type: 8 } } * ... * } * violation { * rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } * ... * } * ``` * */ rule?: FieldPath | undefined; /** * `rule_id` is the unique identifier of the `Rule` that was not fulfilled. * This is the same `id` that was specified in the `Rule` message, allowing easy tracing of which rule was violated. * */ ruleId?: string | undefined; /** * `message` is a human-readable error message that describes the nature of the violation. * This can be the default error message from the violated `Rule`, or it can be a custom message that gives more context about the violation. * */ message?: string | undefined; /** * `for_key` indicates whether the violation was caused by a map key, rather than a value. * */ forKey?: boolean | undefined; } /** Encodes, decodes, converts, and creates {@link Violation} messages. */ export declare const Violation: MessageFns; /** * `FieldPath` provides a path to a nested protobuf field. * * This message provides enough information to render a dotted field path even without protobuf descriptors. * It also provides enough information to resolve a nested field through unknown wire data. * */ export interface FieldPath { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.FieldPath"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `elements` contains each element of the path, starting from the root and recursing downward. * */ elements: FieldPathElement[]; } /** Encodes, decodes, converts, and creates {@link FieldPath} messages. */ export declare const FieldPath: MessageFns; /** * `FieldPathElement` provides enough information to nest through a single protobuf field. * * If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. * A path that refers to a value nested under a map key or repeated field index will have a `subscript` value. * The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. * */ export interface FieldPathElement { /** Contains the fully qualified protobuf type name. */ $type: "buf.validate.FieldPathElement"; /** Preserves protobuf fields that this SDK version does not recognize. */ [unknownFieldsSymbol]?: Uint8Array | undefined; /** Returns a safe value for JSON logs. */ [customJson]?: () => unknown; /** * `field_number` is the field number this path element refers to. * */ fieldNumber?: number | undefined; /** * `field_name` contains the field name this path element refers to. * This can be used to display a human-readable path even if the field number is unknown. * */ fieldName?: string | undefined; /** * `field_type` specifies the type of this field. When using reflection, this value is not needed. * * This value is provided to make it possible to traverse unknown fields through wire data. * When traversing wire data, be mindful of both packed[1] and delimited[2] encoding schemes. * * [1]: https://protobuf.dev/programming-guides/encoding/#packed * [2]: https://protobuf.dev/programming-guides/encoding/#groups * * N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and * can be explicitly used in Protocol Buffers 2023 Edition. * */ fieldType?: FieldDescriptorProto_Type | undefined; /** * `key_type` specifies the map key type of this field. This value is useful when traversing * unknown fields through wire data: specifically, it allows handling the differences between * different integer encodings. * */ keyType?: FieldDescriptorProto_Type | undefined; /** * `value_type` specifies map value type of this field. This is useful if you want to display a * value inside unknown fields through wire data. * */ valueType?: FieldDescriptorProto_Type | undefined; /** * `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. * */ subscript?: { $case: "index"; index: Long; } | { $case: "boolKey"; boolKey: boolean; } | { $case: "intKey"; intKey: Long; } | { $case: "uintKey"; uintKey: Long; } | { $case: "stringKey"; stringKey: string; } | undefined; } /** Encodes, decodes, converts, and creates {@link FieldPathElement} messages. */ export declare const FieldPathElement: MessageFns; import "../../google/protobuf/index.js"; declare module '../../google/protobuf/index.js' { interface MessageOptions { message?: MessageRules; } } declare module '../../google/protobuf/index.js' { interface OneofOptions { oneof?: OneofRules; } } declare module '../../google/protobuf/index.js' { interface FieldOptions { field?: FieldRules; } } declare module '../../google/protobuf/index.js' { interface FieldOptions { predefined?: PredefinedRules; } } //# sourceMappingURL=index.d.ts.map