@nebius/js-sdk - v0.2.54
    Preparing search index...

    Interface FieldRules

    FieldRules encapsulates the rules for each type of field. Depending on the field, the correct set should be used to ensure proper validations.

    interface FieldRules {
        "[customJson]"?: () => unknown;
        "[unknownFieldsSymbol]"?: Uint8Array<ArrayBufferLike>;
        $type: "buf.validate.FieldRules";
        cel: Rule[];
        celExpression: string[];
        ignore?: Ignore;
        required?: boolean;
        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 };
        [key: symbol]: Uint8Array<ArrayBufferLike> | (() => unknown) | undefined;
    }

    Indexable

    • [key: symbol]: Uint8Array<ArrayBufferLike> | (() => unknown) | undefined

      FieldRules encapsulates the rules for each type of field. Depending on the field, the correct set should be used to ensure proper validations.

      • Uint8Array<ArrayBufferLike>
      • () => unknown
          • (): unknown
          • FieldRules encapsulates the rules for each type of field. Depending on the field, the correct set should be used to ensure proper validations.

            Returns unknown

      • undefined
    Index
    "[customJson]"?: () => unknown

    Returns a safe value for JSON logs.

    Type Declaration

      • (): unknown
      • Returns a safe value for JSON logs.

        Returns unknown

    "[unknownFieldsSymbol]"?: Uint8Array<ArrayBufferLike>

    Preserves protobuf fields that this SDK version does not recognize.

    $type: "buf.validate.FieldRules"

    Contains the fully qualified protobuf type name.

    cel: Rule[]

    cel is a repeated field used to represent a textual expression in the Common Expression Language (CEL) syntax. For more information, see our documentation.

    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",
    }];
    }
    celExpression: string[]

    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.

    message MyMessage {
    // The field `value` must be greater than 42.
    optional int32 value = 1 [(buf.validate.field).cel_expression = "this > 42"];
    }
    ignore?: Ignore

    Ignore validation rules on the field if its value matches the specified criteria. See the Ignore enum for details.

    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
    ];
    }
    required?: boolean

    If required is true, the field must be set. A validation error is returned if the field is not set.

    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.

    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.

    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.

    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 }

    Contains the selected value for the type protobuf oneof.

    Type Declaration

    • { $case: "float"; float: FloatRules }
      • $case: "float"

        Contains the case.

      • float: FloatRules

        Contains the float.

    • { $case: "double"; double: DoubleRules }
      • $case: "double"

        Contains the case.

      • double: DoubleRules

        Contains the double.

    • { $case: "int32"; int32: Int32Rules }
      • $case: "int32"

        Contains the case.

      • int32: Int32Rules

        Contains the int32.

    • { $case: "int64"; int64: Int64Rules }
      • $case: "int64"

        Contains the case.

      • int64: Int64Rules

        Contains the int64.

    • { $case: "uint32"; uint32: UInt32Rules }
      • $case: "uint32"

        Contains the case.

      • uint32: UInt32Rules

        Contains the uint32.

    • { $case: "uint64"; uint64: UInt64Rules }
      • $case: "uint64"

        Contains the case.

      • uint64: UInt64Rules

        Contains the uint64.

    • { $case: "sint32"; sint32: SInt32Rules }
      • $case: "sint32"

        Contains the case.

      • sint32: SInt32Rules

        Contains the sint32.

    • { $case: "sint64"; sint64: SInt64Rules }
      • $case: "sint64"

        Contains the case.

      • sint64: SInt64Rules

        Contains the sint64.

    • { $case: "fixed32"; fixed32: Fixed32Rules }
      • $case: "fixed32"

        Contains the case.

      • fixed32: Fixed32Rules

        Contains the fixed32.

    • { $case: "fixed64"; fixed64: Fixed64Rules }
      • $case: "fixed64"

        Contains the case.

      • fixed64: Fixed64Rules

        Contains the fixed64.

    • { $case: "sfixed32"; sfixed32: SFixed32Rules }
      • $case: "sfixed32"

        Contains the case.

      • sfixed32: SFixed32Rules

        Contains the sfixed32.

    • { $case: "sfixed64"; sfixed64: SFixed64Rules }
      • $case: "sfixed64"

        Contains the case.

      • sfixed64: SFixed64Rules

        Contains the sfixed64.

    • { $case: "bool"; bool: BoolRules }
      • $case: "bool"

        Contains the case.

      • bool: BoolRules

        Contains the bool.

    • { $case: "string"; string: StringRules }
      • $case: "string"

        Contains the case.

      • string: StringRules

        Contains the string.

    • { $case: "bytes"; bytes: BytesRules }
      • $case: "bytes"

        Contains the case.

      • bytes: BytesRules

        Contains the bytes.

    • { $case: "enum"; enum: EnumRules }
      • $case: "enum"

        Contains the case.

      • enum: EnumRules

        Contains the enum.

    • { $case: "repeated"; repeated: RepeatedRules }
      • $case: "repeated"

        Contains the case.

      • repeated: RepeatedRules

        Contains the repeated.

    • { $case: "map"; map: MapRules }
      • $case: "map"

        Contains the case.

      • map: MapRules

        Contains the map.

    • { $case: "any"; any: AnyRules }
      • $case: "any"

        Contains the case.

      • any: AnyRules

        Contains the any.

    • { $case: "duration"; duration: DurationRules }
      • $case: "duration"

        Contains the case.

      • duration: DurationRules

        Contains the duration.

    • { $case: "fieldMask"; fieldMask: FieldMaskRules }
      • $case: "fieldMask"

        Contains the case.

      • fieldMask: FieldMaskRules

        Contains the field mask.

    • { $case: "timestamp"; timestamp: TimestampRules }
      • $case: "timestamp"

        Contains the case.

      • timestamp: TimestampRules

        Contains the timestamp.