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

    Interface StringRules

    StringRules describes the rules applied to string values These rules may also be applied to the google.protobuf.StringValue Well-Known-Type.

    interface StringRules {
        "[customJson]"?: () => unknown;
        "[unknownFieldsSymbol]"?: Uint8Array<ArrayBufferLike>;
        $type: "buf.validate.StringRules";
        const?: string;
        contains?: string;
        example: string[];
        in: string[];
        len?: Long;
        lenBytes?: Long;
        maxBytes?: Long;
        maxLen?: Long;
        minBytes?: Long;
        minLen?: Long;
        notContains?: string;
        notIn: string[];
        pattern?: string;
        prefix?: string;
        strict?: boolean;
        suffix?: string;
        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 };
        [key: symbol]: Uint8Array<ArrayBufferLike> | (() => unknown) | undefined;
    }

    Indexable

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

      StringRules describes the rules applied to string values These rules may also be applied to the google.protobuf.StringValue Well-Known-Type.

      • Uint8Array<ArrayBufferLike>
      • () => unknown
          • (): unknown
          • StringRules describes the rules applied to string values These rules may also be applied to the google.protobuf.StringValue Well-Known-Type.

            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.StringRules"

    Contains the fully qualified protobuf type name.

    const?: string

    const requires the field value to exactly match the specified value. If the field value doesn't match, an error message is generated.

    message MyString {
    // value must equal `hello`
    string value = 1 [(buf.validate.field).string.const = "hello"];
    }
    contains?: string

    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.

    message MyString {
    // value does not contain substring `inside`.
    string value = 1 [(buf.validate.field).string.contains = "inside"];
    }
    example: 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.

    message MyString {
    string value = 1 [
    (buf.validate.field).string.example = "hello",
    (buf.validate.field).string.example = "world"
    ];
    }
    in: string[]

    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.

    message MyString {
    // value must be in list ["apple", "banana"]
    string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"];
    }
    len?: Long

    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.

    message MyString {
    // value length must be 5 characters
    string value = 1 [(buf.validate.field).string.len = 5];
    }
    lenBytes?: Long

    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.

    message MyString {
    // value length must be 6 bytes
    string value = 1 [(buf.validate.field).string.len_bytes = 6];
    }
    maxBytes?: Long

    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.

    message MyString {
    // value length must be at most 8 bytes
    string value = 1 [(buf.validate.field).string.max_bytes = 8];
    }
    maxLen?: Long

    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.

    message MyString {
    // value length must be at most 10 characters
    string value = 1 [(buf.validate.field).string.max_len = 10];
    }
    minBytes?: Long

    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.

    message MyString {
    // value length must be at least 4 bytes
    string value = 1 [(buf.validate.field).string.min_bytes = 4];
    }
    minLen?: Long

    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.

    message MyString {
    // value length must be at least 3 characters
    string value = 1 [(buf.validate.field).string.min_len = 3];
    }
    notContains?: string

    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.

    message MyString {
    // value contains substring `inside`.
    string value = 1 [(buf.validate.field).string.not_contains = "inside"];
    }
    notIn: 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.

    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"];
    }
    pattern?: string

    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.

    message MyString {
    // value does not match regex pattern `^[a-zA-Z]//$`
    string value = 1 [(buf.validate.field).string.pattern = "^[a-zA-Z]//$"];
    }
    prefix?: string

    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.

    message MyString {
    // value does not have prefix `pre`
    string value = 1 [(buf.validate.field).string.prefix = "pre"];
    }
    strict?: boolean

    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. Setting to false will enable looser validations that only disallow \r\n\0 characters, which can be used to bypass header matching rules.

    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];
    }
    suffix?: string

    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.

    message MyString {
    // value does not have suffix `post`
    string value = 1 [(buf.validate.field).string.suffix = "post"];
    }
    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 }

    WellKnown rules provide advanced rules against common string patterns.

    Type Declaration

    • { $case: "email"; email: boolean }
      • $case: "email"

        Contains the case.

      • email: boolean

        Contains the email.

    • { $case: "hostname"; hostname: boolean }
      • $case: "hostname"

        Contains the case.

      • hostname: boolean

        Contains the hostname.

    • { $case: "ip"; ip: boolean }
      • $case: "ip"

        Contains the case.

      • ip: boolean

        Contains the ip.

    • { $case: "ipv4"; ipv4: boolean }
      • $case: "ipv4"

        Contains the case.

      • ipv4: boolean

        Contains the ipv4.

    • { $case: "ipv6"; ipv6: boolean }
      • $case: "ipv6"

        Contains the case.

      • ipv6: boolean

        Contains the ipv6.

    • { $case: "uri"; uri: boolean }
      • $case: "uri"

        Contains the case.

      • uri: boolean

        Contains the uri.

    • { $case: "uriRef"; uriRef: boolean }
      • $case: "uriRef"

        Contains the case.

      • uriRef: boolean

        Contains the uri ref.

    • { $case: "address"; address: boolean }
      • $case: "address"

        Contains the case.

      • address: boolean

        Contains the address.

    • { $case: "uuid"; uuid: boolean }
      • $case: "uuid"

        Contains the case.

      • uuid: boolean

        Contains the uuid.

    • { $case: "tuuid"; tuuid: boolean }
      • $case: "tuuid"

        Contains the case.

      • tuuid: boolean

        Contains the tuuid.

    • { $case: "ipWithPrefixlen"; ipWithPrefixlen: boolean }
      • $case: "ipWithPrefixlen"

        Contains the case.

      • ipWithPrefixlen: boolean

        Contains the ip with prefixlen.

    • { $case: "ipv4WithPrefixlen"; ipv4WithPrefixlen: boolean }
      • $case: "ipv4WithPrefixlen"

        Contains the case.

      • ipv4WithPrefixlen: boolean

        Contains the ipv4 with prefixlen.

    • { $case: "ipv6WithPrefixlen"; ipv6WithPrefixlen: boolean }
      • $case: "ipv6WithPrefixlen"

        Contains the case.

      • ipv6WithPrefixlen: boolean

        Contains the ipv6 with prefixlen.

    • { $case: "ipPrefix"; ipPrefix: boolean }
      • $case: "ipPrefix"

        Contains the case.

      • ipPrefix: boolean

        Contains the ip prefix.

    • { $case: "ipv4Prefix"; ipv4Prefix: boolean }
      • $case: "ipv4Prefix"

        Contains the case.

      • ipv4Prefix: boolean

        Contains the ipv4 prefix.

    • { $case: "ipv6Prefix"; ipv6Prefix: boolean }
      • $case: "ipv6Prefix"

        Contains the case.

      • ipv6Prefix: boolean

        Contains the ipv6 prefix.

    • { $case: "hostAndPort"; hostAndPort: boolean }
      • $case: "hostAndPort"

        Contains the case.

      • hostAndPort: boolean

        Contains the host and port.

    • { $case: "ulid"; ulid: boolean }
      • $case: "ulid"

        Contains the case.

      • ulid: boolean

        Contains the ulid.

    • { $case: "wellKnownRegex"; wellKnownRegex: KnownRegex }
      • $case: "wellKnownRegex"

        Contains the case.

      • wellKnownRegex: KnownRegex

        Contains the well known regex.