Module nitric.proto.validate

Expand source code
#
# Copyright (c) 2021 Nitric Technologies Pty Ltd.
#
# This file is part of Nitric Python 3 SDK.
# See https://github.com/nitrictech/python-sdk for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: validate/validate.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import (
    datetime,
    timedelta,
)
from typing import List

import betterproto


class KnownRegex(betterproto.Enum):
    """WellKnownRegex contain some well-known patterns."""

    UNKNOWN = 0
    HTTP_HEADER_NAME = 1
    """HTTP header name as defined by RFC 7230."""

    HTTP_HEADER_VALUE = 2
    """HTTP header value as defined by RFC 7230."""


@dataclass(eq=False, repr=False)
class FieldRules(betterproto.Message):
    """
    FieldRules encapsulates the rules for each type of field. Depending on the
    field, the correct set should be used to ensure proper validations.
    """

    message: "MessageRules" = betterproto.message_field(17)
    float: "FloatRules" = betterproto.message_field(1, group="type")
    """Scalar Field Types"""

    double: "DoubleRules" = betterproto.message_field(2, group="type")
    int32: "Int32Rules" = betterproto.message_field(3, group="type")
    int64: "Int64Rules" = betterproto.message_field(4, group="type")
    uint32: "UInt32Rules" = betterproto.message_field(5, group="type")
    uint64: "UInt64Rules" = betterproto.message_field(6, group="type")
    sint32: "SInt32Rules" = betterproto.message_field(7, group="type")
    sint64: "SInt64Rules" = betterproto.message_field(8, group="type")
    fixed32: "Fixed32Rules" = betterproto.message_field(9, group="type")
    fixed64: "Fixed64Rules" = betterproto.message_field(10, group="type")
    sfixed32: "SFixed32Rules" = betterproto.message_field(11, group="type")
    sfixed64: "SFixed64Rules" = betterproto.message_field(12, group="type")
    bool: "BoolRules" = betterproto.message_field(13, group="type")
    string: "StringRules" = betterproto.message_field(14, group="type")
    bytes: "BytesRules" = betterproto.message_field(15, group="type")
    enum: "EnumRules" = betterproto.message_field(16, group="type")
    """Complex Field Types"""

    repeated: "RepeatedRules" = betterproto.message_field(18, group="type")
    map: "MapRules" = betterproto.message_field(19, group="type")
    any: "AnyRules" = betterproto.message_field(20, group="type")
    """Well-Known Field Types"""

    duration: "DurationRules" = betterproto.message_field(21, group="type")
    timestamp: "TimestampRules" = betterproto.message_field(22, group="type")


@dataclass(eq=False, repr=False)
class FloatRules(betterproto.Message):
    """FloatRules describes the constraints applied to `float` values"""

    const: float = betterproto.float_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: float = betterproto.float_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: float = betterproto.float_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: float = betterproto.float_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: float = betterproto.float_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[float] = betterproto.float_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[float] = betterproto.float_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class DoubleRules(betterproto.Message):
    """DoubleRules describes the constraints applied to `double` values"""

    const: float = betterproto.double_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: float = betterproto.double_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: float = betterproto.double_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: float = betterproto.double_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: float = betterproto.double_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[float] = betterproto.double_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[float] = betterproto.double_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class Int32Rules(betterproto.Message):
    """Int32Rules describes the constraints applied to `int32` values"""

    const: int = betterproto.int32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.int32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.int32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.int32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.int32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.int32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.int32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class Int64Rules(betterproto.Message):
    """Int64Rules describes the constraints applied to `int64` values"""

    const: int = betterproto.int64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.int64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.int64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.int64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.int64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.int64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.int64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class UInt32Rules(betterproto.Message):
    """UInt32Rules describes the constraints applied to `uint32` values"""

    const: int = betterproto.uint32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.uint32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.uint32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.uint32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.uint32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.uint32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.uint32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class UInt64Rules(betterproto.Message):
    """UInt64Rules describes the constraints applied to `uint64` values"""

    const: int = betterproto.uint64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.uint64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.uint64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.uint64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.uint64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.uint64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.uint64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class SInt32Rules(betterproto.Message):
    """SInt32Rules describes the constraints applied to `sint32` values"""

    const: int = betterproto.sint32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sint32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sint32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sint32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sint32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sint32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sint32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class SInt64Rules(betterproto.Message):
    """SInt64Rules describes the constraints applied to `sint64` values"""

    const: int = betterproto.sint64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sint64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sint64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sint64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sint64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sint64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sint64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class Fixed32Rules(betterproto.Message):
    """Fixed32Rules describes the constraints applied to `fixed32` values"""

    const: int = betterproto.fixed32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.fixed32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.fixed32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.fixed32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.fixed32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.fixed32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.fixed32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class Fixed64Rules(betterproto.Message):
    """Fixed64Rules describes the constraints applied to `fixed64` values"""

    const: int = betterproto.fixed64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.fixed64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.fixed64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.fixed64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.fixed64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.fixed64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.fixed64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class SFixed32Rules(betterproto.Message):
    """SFixed32Rules describes the constraints applied to `sfixed32` values"""

    const: int = betterproto.sfixed32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sfixed32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sfixed32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sfixed32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sfixed32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sfixed32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sfixed32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class SFixed64Rules(betterproto.Message):
    """SFixed64Rules describes the constraints applied to `sfixed64` values"""

    const: int = betterproto.sfixed64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sfixed64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sfixed64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sfixed64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sfixed64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sfixed64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sfixed64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class BoolRules(betterproto.Message):
    """BoolRules describes the constraints applied to `bool` values"""

    const: bool = betterproto.bool_field(1)
    """Const specifies that this field must be exactly the specified value"""


@dataclass(eq=False, repr=False)
class StringRules(betterproto.Message):
    """StringRules describe the constraints applied to `string` values"""

    const: str = betterproto.string_field(1)
    """Const specifies that this field must be exactly the specified value"""

    len: int = betterproto.uint64_field(19)
    """
    Len specifies that this field must be the specified number of characters
    (Unicode code points). Note that the number of characters may differ from
    the number of bytes in the string.
    """

    min_len: int = betterproto.uint64_field(2)
    """
    MinLen specifies that this field must be the specified number of characters
    (Unicode code points) at a minimum. Note that the number of characters may
    differ from the number of bytes in the string.
    """

    max_len: int = betterproto.uint64_field(3)
    """
    MaxLen specifies that this field must be the specified number of characters
    (Unicode code points) at a maximum. Note that the number of characters may
    differ from the number of bytes in the string.
    """

    len_bytes: int = betterproto.uint64_field(20)
    """
    LenBytes specifies that this field must be the specified number of bytes at
    a minimum
    """

    min_bytes: int = betterproto.uint64_field(4)
    """
    MinBytes specifies that this field must be the specified number of bytes at
    a minimum
    """

    max_bytes: int = betterproto.uint64_field(5)
    """
    MaxBytes specifies that this field must be the specified number of bytes at
    a maximum
    """

    pattern: str = betterproto.string_field(6)
    """
    Pattern specifes that this field must match against the specified regular
    expression (RE2 syntax). The included expression should elide any
    delimiters.
    """

    prefix: str = betterproto.string_field(7)
    """
    Prefix specifies that this field must have the specified substring at the
    beginning of the string.
    """

    suffix: str = betterproto.string_field(8)
    """
    Suffix specifies that this field must have the specified substring at the
    end of the string.
    """

    contains: str = betterproto.string_field(9)
    """
    Contains specifies that this field must have the specified substring
    anywhere in the string.
    """

    not_contains: str = betterproto.string_field(23)
    """
    NotContains specifies that this field cannot have the specified substring
    anywhere in the string.
    """

    in_: List[str] = betterproto.string_field(10)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[str] = betterproto.string_field(11)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    email: bool = betterproto.bool_field(12, group="well_known")
    """
    Email specifies that the field must be a valid email address as defined by
    RFC 5322
    """

    hostname: bool = betterproto.bool_field(13, group="well_known")
    """
    Hostname specifies that the field must be a valid hostname as defined by
    RFC 1034. This constraint does not support internationalized domain names
    (IDNs).
    """

    ip: bool = betterproto.bool_field(14, group="well_known")
    """
    Ip specifies that the field must be a valid IP (v4 or v6) address. Valid
    IPv6 addresses should not include surrounding square brackets.
    """

    ipv4: bool = betterproto.bool_field(15, group="well_known")
    """Ipv4 specifies that the field must be a valid IPv4 address."""

    ipv6: bool = betterproto.bool_field(16, group="well_known")
    """
    Ipv6 specifies that the field must be a valid IPv6 address. Valid IPv6
    addresses should not include surrounding square brackets.
    """

    uri: bool = betterproto.bool_field(17, group="well_known")
    """
    Uri specifies that the field must be a valid, absolute URI as defined by
    RFC 3986
    """

    uri_ref: bool = betterproto.bool_field(18, group="well_known")
    """
    UriRef specifies that the field must be a valid URI as defined by RFC 3986
    and may be relative or absolute.
    """

    address: bool = betterproto.bool_field(21, group="well_known")
    """
    Address specifies that the field must be either a valid hostname as defined
    by RFC 1034 (which does not support internationalized domain names or
    IDNs), or it can be a valid IP (v4 or v6).
    """

    uuid: bool = betterproto.bool_field(22, group="well_known")
    """
    Uuid specifies that the field must be a valid UUID as defined by RFC 4122
    """

    well_known_regex: "KnownRegex" = betterproto.enum_field(24, group="well_known")
    """
    WellKnownRegex specifies a common well known pattern defined as a regex.
    """

    strict: bool = betterproto.bool_field(25)
    """
    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 a looser
    validations that only disallows \r\n\0 characters, which can be used to
    bypass header matching rules.
    """

    ignore_empty: bool = betterproto.bool_field(26)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class BytesRules(betterproto.Message):
    """BytesRules describe the constraints applied to `bytes` values"""

    const: bytes = betterproto.bytes_field(1)
    """Const specifies that this field must be exactly the specified value"""

    len: int = betterproto.uint64_field(13)
    """Len specifies that this field must be the specified number of bytes"""

    min_len: int = betterproto.uint64_field(2)
    """
    MinLen specifies that this field must be the specified number of bytes at a
    minimum
    """

    max_len: int = betterproto.uint64_field(3)
    """
    MaxLen specifies that this field must be the specified number of bytes at a
    maximum
    """

    pattern: str = betterproto.string_field(4)
    """
    Pattern specifes that this field must match against the specified regular
    expression (RE2 syntax). The included expression should elide any
    delimiters.
    """

    prefix: bytes = betterproto.bytes_field(5)
    """
    Prefix specifies that this field must have the specified bytes at the
    beginning of the string.
    """

    suffix: bytes = betterproto.bytes_field(6)
    """
    Suffix specifies that this field must have the specified bytes at the end
    of the string.
    """

    contains: bytes = betterproto.bytes_field(7)
    """
    Contains specifies that this field must have the specified bytes anywhere
    in the string.
    """

    in_: List[bytes] = betterproto.bytes_field(8)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[bytes] = betterproto.bytes_field(9)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ip: bool = betterproto.bool_field(10, group="well_known")
    """
    Ip specifies that the field must be a valid IP (v4 or v6) address in byte
    format
    """

    ipv4: bool = betterproto.bool_field(11, group="well_known")
    """
    Ipv4 specifies that the field must be a valid IPv4 address in byte format
    """

    ipv6: bool = betterproto.bool_field(12, group="well_known")
    """
    Ipv6 specifies that the field must be a valid IPv6 address in byte format
    """

    ignore_empty: bool = betterproto.bool_field(14)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class EnumRules(betterproto.Message):
    """EnumRules describe the constraints applied to enum values"""

    const: int = betterproto.int32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    defined_only: bool = betterproto.bool_field(2)
    """
    DefinedOnly specifies that this field must be only one of the defined
    values for this enum, failing on any undefined value.
    """

    in_: List[int] = betterproto.int32_field(3)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.int32_field(4)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """


@dataclass(eq=False, repr=False)
class MessageRules(betterproto.Message):
    """
    MessageRules describe the constraints applied to embedded message values.
    For message-type fields, validation is performed recursively.
    """

    skip: bool = betterproto.bool_field(1)
    """
    Skip specifies that the validation rules of this field should not be
    evaluated
    """

    required: bool = betterproto.bool_field(2)
    """Required specifies that this field must be set"""


@dataclass(eq=False, repr=False)
class RepeatedRules(betterproto.Message):
    """RepeatedRules describe the constraints applied to `repeated` values"""

    min_items: int = betterproto.uint64_field(1)
    """
    MinItems specifies that this field must have the specified number of items
    at a minimum
    """

    max_items: int = betterproto.uint64_field(2)
    """
    MaxItems specifies that this field must have the specified number of items
    at a maximum
    """

    unique: bool = betterproto.bool_field(3)
    """
    Unique specifies that all elements in this field must be unique. This
    contraint is only applicable to scalar and enum types (messages are not
    supported).
    """

    items: "FieldRules" = betterproto.message_field(4)
    """
    Items specifies the contraints to be applied to each item in the field.
    Repeated message fields will still execute validation against each item
    unless skip is specified here.
    """

    ignore_empty: bool = betterproto.bool_field(5)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class MapRules(betterproto.Message):
    """MapRules describe the constraints applied to `map` values"""

    min_pairs: int = betterproto.uint64_field(1)
    """
    MinPairs specifies that this field must have the specified number of KVs at
    a minimum
    """

    max_pairs: int = betterproto.uint64_field(2)
    """
    MaxPairs specifies that this field must have the specified number of KVs at
    a maximum
    """

    no_sparse: bool = betterproto.bool_field(3)
    """
    NoSparse specifies values in this field cannot be unset. This only applies
    to map's with message value types.
    """

    keys: "FieldRules" = betterproto.message_field(4)
    """
    Keys specifies the constraints to be applied to each key in the field.
    """

    values: "FieldRules" = betterproto.message_field(5)
    """
    Values specifies the constraints to be applied to the value of each key in
    the field. Message values will still have their validations evaluated
    unless skip is specified here.
    """

    ignore_empty: bool = betterproto.bool_field(6)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """


@dataclass(eq=False, repr=False)
class AnyRules(betterproto.Message):
    """
    AnyRules describe constraints applied exclusively to the
    `google.protobuf.Any` well-known type
    """

    required: bool = betterproto.bool_field(1)
    """Required specifies that this field must be set"""

    in_: List[str] = betterproto.string_field(2)
    """
    In specifies that this field's `type_url` must be equal to one of the
    specified values.
    """

    not_in: List[str] = betterproto.string_field(3)
    """
    NotIn specifies that this field's `type_url` must not be equal to any of
    the specified values.
    """


@dataclass(eq=False, repr=False)
class DurationRules(betterproto.Message):
    """
    DurationRules describe the constraints applied exclusively to the
    `google.protobuf.Duration` well-known type
    """

    required: bool = betterproto.bool_field(1)
    """Required specifies that this field must be set"""

    const: timedelta = betterproto.message_field(2)
    """Const specifies that this field must be exactly the specified value"""

    lt: timedelta = betterproto.message_field(3)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: timedelta = betterproto.message_field(4)
    """
    Lt specifies that this field must be less than the specified value,
    inclusive
    """

    gt: timedelta = betterproto.message_field(5)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive
    """

    gte: timedelta = betterproto.message_field(6)
    """
    Gte specifies that this field must be greater than the specified value,
    inclusive
    """

    in_: List[timedelta] = betterproto.message_field(7)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[timedelta] = betterproto.message_field(8)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """


@dataclass(eq=False, repr=False)
class TimestampRules(betterproto.Message):
    """
    TimestampRules describe the constraints applied exclusively to the
    `google.protobuf.Timestamp` well-known type
    """

    required: bool = betterproto.bool_field(1)
    """Required specifies that this field must be set"""

    const: datetime = betterproto.message_field(2)
    """Const specifies that this field must be exactly the specified value"""

    lt: datetime = betterproto.message_field(3)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: datetime = betterproto.message_field(4)
    """
    Lte specifies that this field must be less than the specified value,
    inclusive
    """

    gt: datetime = betterproto.message_field(5)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive
    """

    gte: datetime = betterproto.message_field(6)
    """
    Gte specifies that this field must be greater than the specified value,
    inclusive
    """

    lt_now: bool = betterproto.bool_field(7)
    """
    LtNow specifies that this must be less than the current time. LtNow can
    only be used with the Within rule.
    """

    gt_now: bool = betterproto.bool_field(8)
    """
    GtNow specifies that this must be greater than the current time. GtNow can
    only be used with the Within rule.
    """

    within: timedelta = betterproto.message_field(9)
    """
    Within specifies that this field must be within this duration of the
    current time. This constraint can be used alone or with the LtNow and GtNow
    rules.
    """

Classes

class AnyRules (required: bool = <object object>, in_: List[str] = <object object>, not_in: List[str] = <object object>)

AnyRules describe constraints applied exclusively to the google.protobuf.Any well-known type

Expand source code
@dataclass(eq=False, repr=False)
class AnyRules(betterproto.Message):
    """
    AnyRules describe constraints applied exclusively to the
    `google.protobuf.Any` well-known type
    """

    required: bool = betterproto.bool_field(1)
    """Required specifies that this field must be set"""

    in_: List[str] = betterproto.string_field(2)
    """
    In specifies that this field's `type_url` must be equal to one of the
    specified values.
    """

    not_in: List[str] = betterproto.string_field(3)
    """
    NotIn specifies that this field's `type_url` must not be equal to any of
    the specified values.
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var in_ : List[str]

In specifies that this field's type_url must be equal to one of the specified values.

var not_in : List[str]

NotIn specifies that this field's type_url must not be equal to any of the specified values.

var required : bool

Required specifies that this field must be set

class BoolRules (const: bool = <object object>)

BoolRules describes the constraints applied to bool values

Expand source code
@dataclass(eq=False, repr=False)
class BoolRules(betterproto.Message):
    """BoolRules describes the constraints applied to `bool` values"""

    const: bool = betterproto.bool_field(1)
    """Const specifies that this field must be exactly the specified value"""

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : bool

Const specifies that this field must be exactly the specified value

class BytesRules (const: bytes = <object object>, len: int = <object object>, min_len: int = <object object>, max_len: int = <object object>, pattern: str = <object object>, prefix: bytes = <object object>, suffix: bytes = <object object>, contains: bytes = <object object>, in_: List[bytes] = <object object>, not_in: List[bytes] = <object object>, ip: bool = <object object>, ipv4: bool = <object object>, ipv6: bool = <object object>, ignore_empty: bool = <object object>)

BytesRules describe the constraints applied to bytes values

Expand source code
@dataclass(eq=False, repr=False)
class BytesRules(betterproto.Message):
    """BytesRules describe the constraints applied to `bytes` values"""

    const: bytes = betterproto.bytes_field(1)
    """Const specifies that this field must be exactly the specified value"""

    len: int = betterproto.uint64_field(13)
    """Len specifies that this field must be the specified number of bytes"""

    min_len: int = betterproto.uint64_field(2)
    """
    MinLen specifies that this field must be the specified number of bytes at a
    minimum
    """

    max_len: int = betterproto.uint64_field(3)
    """
    MaxLen specifies that this field must be the specified number of bytes at a
    maximum
    """

    pattern: str = betterproto.string_field(4)
    """
    Pattern specifes that this field must match against the specified regular
    expression (RE2 syntax). The included expression should elide any
    delimiters.
    """

    prefix: bytes = betterproto.bytes_field(5)
    """
    Prefix specifies that this field must have the specified bytes at the
    beginning of the string.
    """

    suffix: bytes = betterproto.bytes_field(6)
    """
    Suffix specifies that this field must have the specified bytes at the end
    of the string.
    """

    contains: bytes = betterproto.bytes_field(7)
    """
    Contains specifies that this field must have the specified bytes anywhere
    in the string.
    """

    in_: List[bytes] = betterproto.bytes_field(8)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[bytes] = betterproto.bytes_field(9)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ip: bool = betterproto.bool_field(10, group="well_known")
    """
    Ip specifies that the field must be a valid IP (v4 or v6) address in byte
    format
    """

    ipv4: bool = betterproto.bool_field(11, group="well_known")
    """
    Ipv4 specifies that the field must be a valid IPv4 address in byte format
    """

    ipv6: bool = betterproto.bool_field(12, group="well_known")
    """
    Ipv6 specifies that the field must be a valid IPv6 address in byte format
    """

    ignore_empty: bool = betterproto.bool_field(14)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : bytes

Const specifies that this field must be exactly the specified value

var contains : bytes

Contains specifies that this field must have the specified bytes anywhere in the string.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[bytes]

In specifies that this field must be equal to one of the specified values

var ip : bool

Ip specifies that the field must be a valid IP (v4 or v6) address in byte format

var ipv4 : bool

Ipv4 specifies that the field must be a valid IPv4 address in byte format

var ipv6 : bool

Ipv6 specifies that the field must be a valid IPv6 address in byte format

var len : int

Len specifies that this field must be the specified number of bytes

var max_len : int

MaxLen specifies that this field must be the specified number of bytes at a maximum

var min_len : int

MinLen specifies that this field must be the specified number of bytes at a minimum

var not_in : List[bytes]

NotIn specifies that this field cannot be equal to one of the specified values

var pattern : str

Pattern specifes that this field must match against the specified regular expression (RE2 syntax). The included expression should elide any delimiters.

var prefix : bytes

Prefix specifies that this field must have the specified bytes at the beginning of the string.

var suffix : bytes

Suffix specifies that this field must have the specified bytes at the end of the string.

class DoubleRules (const: float = <object object>, lt: float = <object object>, lte: float = <object object>, gt: float = <object object>, gte: float = <object object>, in_: List[float] = <object object>, not_in: List[float] = <object object>, ignore_empty: bool = <object object>)

DoubleRules describes the constraints applied to double values

Expand source code
@dataclass(eq=False, repr=False)
class DoubleRules(betterproto.Message):
    """DoubleRules describes the constraints applied to `double` values"""

    const: float = betterproto.double_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: float = betterproto.double_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: float = betterproto.double_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: float = betterproto.double_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: float = betterproto.double_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[float] = betterproto.double_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[float] = betterproto.double_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : float

Const specifies that this field must be exactly the specified value

var gt : float

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : float

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[float]

In specifies that this field must be equal to one of the specified values

var lt : float

Lt specifies that this field must be less than the specified value, exclusive

var lte : float

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[float]

NotIn specifies that this field cannot be equal to one of the specified values

class DurationRules (required: bool = <object object>, const: datetime.timedelta = <object object>, lt: datetime.timedelta = <object object>, lte: datetime.timedelta = <object object>, gt: datetime.timedelta = <object object>, gte: datetime.timedelta = <object object>, in_: List[datetime.timedelta] = <object object>, not_in: List[datetime.timedelta] = <object object>)

DurationRules describe the constraints applied exclusively to the google.protobuf.Duration well-known type

Expand source code
@dataclass(eq=False, repr=False)
class DurationRules(betterproto.Message):
    """
    DurationRules describe the constraints applied exclusively to the
    `google.protobuf.Duration` well-known type
    """

    required: bool = betterproto.bool_field(1)
    """Required specifies that this field must be set"""

    const: timedelta = betterproto.message_field(2)
    """Const specifies that this field must be exactly the specified value"""

    lt: timedelta = betterproto.message_field(3)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: timedelta = betterproto.message_field(4)
    """
    Lt specifies that this field must be less than the specified value,
    inclusive
    """

    gt: timedelta = betterproto.message_field(5)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive
    """

    gte: timedelta = betterproto.message_field(6)
    """
    Gte specifies that this field must be greater than the specified value,
    inclusive
    """

    in_: List[timedelta] = betterproto.message_field(7)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[timedelta] = betterproto.message_field(8)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : datetime.timedelta

Const specifies that this field must be exactly the specified value

var gt : datetime.timedelta

Gt specifies that this field must be greater than the specified value, exclusive

var gte : datetime.timedelta

Gte specifies that this field must be greater than the specified value, inclusive

var in_ : List[datetime.timedelta]

In specifies that this field must be equal to one of the specified values

var lt : datetime.timedelta

Lt specifies that this field must be less than the specified value, exclusive

var lte : datetime.timedelta

Lt specifies that this field must be less than the specified value, inclusive

var not_in : List[datetime.timedelta]

NotIn specifies that this field cannot be equal to one of the specified values

var required : bool

Required specifies that this field must be set

class EnumRules (const: int = <object object>, defined_only: bool = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>)

EnumRules describe the constraints applied to enum values

Expand source code
@dataclass(eq=False, repr=False)
class EnumRules(betterproto.Message):
    """EnumRules describe the constraints applied to enum values"""

    const: int = betterproto.int32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    defined_only: bool = betterproto.bool_field(2)
    """
    DefinedOnly specifies that this field must be only one of the defined
    values for this enum, failing on any undefined value.
    """

    in_: List[int] = betterproto.int32_field(3)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.int32_field(4)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var defined_only : bool

DefinedOnly specifies that this field must be only one of the defined values for this enum, failing on any undefined value.

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class FieldRules (message: MessageRules = <object object>, float: FloatRules = <object object>, double: DoubleRules = <object object>, int32: Int32Rules = <object object>, int64: Int64Rules = <object object>, uint32: UInt32Rules = <object object>, uint64: UInt64Rules = <object object>, sint32: SInt32Rules = <object object>, sint64: SInt64Rules = <object object>, fixed32: Fixed32Rules = <object object>, fixed64: Fixed64Rules = <object object>, sfixed32: SFixed32Rules = <object object>, sfixed64: SFixed64Rules = <object object>, bool: BoolRules = <object object>, string: StringRules = <object object>, bytes: BytesRules = <object object>, enum: EnumRules = <object object>, repeated: RepeatedRules = <object object>, map: MapRules = <object object>, any: AnyRules = <object object>, duration: DurationRules = <object object>, timestamp: TimestampRules = <object object>)

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

Expand source code
@dataclass(eq=False, repr=False)
class FieldRules(betterproto.Message):
    """
    FieldRules encapsulates the rules for each type of field. Depending on the
    field, the correct set should be used to ensure proper validations.
    """

    message: "MessageRules" = betterproto.message_field(17)
    float: "FloatRules" = betterproto.message_field(1, group="type")
    """Scalar Field Types"""

    double: "DoubleRules" = betterproto.message_field(2, group="type")
    int32: "Int32Rules" = betterproto.message_field(3, group="type")
    int64: "Int64Rules" = betterproto.message_field(4, group="type")
    uint32: "UInt32Rules" = betterproto.message_field(5, group="type")
    uint64: "UInt64Rules" = betterproto.message_field(6, group="type")
    sint32: "SInt32Rules" = betterproto.message_field(7, group="type")
    sint64: "SInt64Rules" = betterproto.message_field(8, group="type")
    fixed32: "Fixed32Rules" = betterproto.message_field(9, group="type")
    fixed64: "Fixed64Rules" = betterproto.message_field(10, group="type")
    sfixed32: "SFixed32Rules" = betterproto.message_field(11, group="type")
    sfixed64: "SFixed64Rules" = betterproto.message_field(12, group="type")
    bool: "BoolRules" = betterproto.message_field(13, group="type")
    string: "StringRules" = betterproto.message_field(14, group="type")
    bytes: "BytesRules" = betterproto.message_field(15, group="type")
    enum: "EnumRules" = betterproto.message_field(16, group="type")
    """Complex Field Types"""

    repeated: "RepeatedRules" = betterproto.message_field(18, group="type")
    map: "MapRules" = betterproto.message_field(19, group="type")
    any: "AnyRules" = betterproto.message_field(20, group="type")
    """Well-Known Field Types"""

    duration: "DurationRules" = betterproto.message_field(21, group="type")
    timestamp: "TimestampRules" = betterproto.message_field(22, group="type")

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var anyAnyRules

Well-Known Field Types

var boolBoolRules
var bytesBytesRules
var doubleDoubleRules
var durationDurationRules
var enumEnumRules

Complex Field Types

var fixed32Fixed32Rules
var fixed64Fixed64Rules
var floatFloatRules

Scalar Field Types

var int32Int32Rules
var int64Int64Rules
var mapMapRules
var messageMessageRules
var repeatedRepeatedRules
var sfixed32SFixed32Rules
var sfixed64SFixed64Rules
var sint32SInt32Rules
var sint64SInt64Rules
var stringStringRules
var timestampTimestampRules
var uint32UInt32Rules
var uint64UInt64Rules
class Fixed32Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

Fixed32Rules describes the constraints applied to fixed32 values

Expand source code
@dataclass(eq=False, repr=False)
class Fixed32Rules(betterproto.Message):
    """Fixed32Rules describes the constraints applied to `fixed32` values"""

    const: int = betterproto.fixed32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.fixed32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.fixed32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.fixed32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.fixed32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.fixed32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.fixed32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class Fixed64Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

Fixed64Rules describes the constraints applied to fixed64 values

Expand source code
@dataclass(eq=False, repr=False)
class Fixed64Rules(betterproto.Message):
    """Fixed64Rules describes the constraints applied to `fixed64` values"""

    const: int = betterproto.fixed64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.fixed64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.fixed64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.fixed64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.fixed64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.fixed64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.fixed64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class FloatRules (const: float = <object object>, lt: float = <object object>, lte: float = <object object>, gt: float = <object object>, gte: float = <object object>, in_: List[float] = <object object>, not_in: List[float] = <object object>, ignore_empty: bool = <object object>)

FloatRules describes the constraints applied to float values

Expand source code
@dataclass(eq=False, repr=False)
class FloatRules(betterproto.Message):
    """FloatRules describes the constraints applied to `float` values"""

    const: float = betterproto.float_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: float = betterproto.float_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: float = betterproto.float_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: float = betterproto.float_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: float = betterproto.float_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[float] = betterproto.float_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[float] = betterproto.float_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : float

Const specifies that this field must be exactly the specified value

var gt : float

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : float

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[float]

In specifies that this field must be equal to one of the specified values

var lt : float

Lt specifies that this field must be less than the specified value, exclusive

var lte : float

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[float]

NotIn specifies that this field cannot be equal to one of the specified values

class Int32Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

Int32Rules describes the constraints applied to int32 values

Expand source code
@dataclass(eq=False, repr=False)
class Int32Rules(betterproto.Message):
    """Int32Rules describes the constraints applied to `int32` values"""

    const: int = betterproto.int32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.int32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.int32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.int32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.int32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.int32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.int32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class Int64Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

Int64Rules describes the constraints applied to int64 values

Expand source code
@dataclass(eq=False, repr=False)
class Int64Rules(betterproto.Message):
    """Int64Rules describes the constraints applied to `int64` values"""

    const: int = betterproto.int64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.int64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.int64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.int64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.int64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.int64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.int64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class KnownRegex (value, names=None, *, module=None, qualname=None, type=None, start=1)

WellKnownRegex contain some well-known patterns.

Expand source code
class KnownRegex(betterproto.Enum):
    """WellKnownRegex contain some well-known patterns."""

    UNKNOWN = 0
    HTTP_HEADER_NAME = 1
    """HTTP header name as defined by RFC 7230."""

    HTTP_HEADER_VALUE = 2
    """HTTP header value as defined by RFC 7230."""

Ancestors

  • betterproto.Enum
  • enum.IntEnum
  • builtins.int
  • enum.Enum

Class variables

var HTTP_HEADER_NAME

HTTP header name as defined by RFC 7230.

var HTTP_HEADER_VALUE

HTTP header value as defined by RFC 7230.

var UNKNOWN
class MapRules (min_pairs: int = <object object>, max_pairs: int = <object object>, no_sparse: bool = <object object>, keys: FieldRules = <object object>, values: FieldRules = <object object>, ignore_empty: bool = <object object>)

MapRules describe the constraints applied to map values

Expand source code
@dataclass(eq=False, repr=False)
class MapRules(betterproto.Message):
    """MapRules describe the constraints applied to `map` values"""

    min_pairs: int = betterproto.uint64_field(1)
    """
    MinPairs specifies that this field must have the specified number of KVs at
    a minimum
    """

    max_pairs: int = betterproto.uint64_field(2)
    """
    MaxPairs specifies that this field must have the specified number of KVs at
    a maximum
    """

    no_sparse: bool = betterproto.bool_field(3)
    """
    NoSparse specifies values in this field cannot be unset. This only applies
    to map's with message value types.
    """

    keys: "FieldRules" = betterproto.message_field(4)
    """
    Keys specifies the constraints to be applied to each key in the field.
    """

    values: "FieldRules" = betterproto.message_field(5)
    """
    Values specifies the constraints to be applied to the value of each key in
    the field. Message values will still have their validations evaluated
    unless skip is specified here.
    """

    ignore_empty: bool = betterproto.bool_field(6)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var keysFieldRules

Keys specifies the constraints to be applied to each key in the field.

var max_pairs : int

MaxPairs specifies that this field must have the specified number of KVs at a maximum

var min_pairs : int

MinPairs specifies that this field must have the specified number of KVs at a minimum

var no_sparse : bool

NoSparse specifies values in this field cannot be unset. This only applies to map's with message value types.

var valuesFieldRules

Values specifies the constraints to be applied to the value of each key in the field. Message values will still have their validations evaluated unless skip is specified here.

class MessageRules (skip: bool = <object object>, required: bool = <object object>)

MessageRules describe the constraints applied to embedded message values. For message-type fields, validation is performed recursively.

Expand source code
@dataclass(eq=False, repr=False)
class MessageRules(betterproto.Message):
    """
    MessageRules describe the constraints applied to embedded message values.
    For message-type fields, validation is performed recursively.
    """

    skip: bool = betterproto.bool_field(1)
    """
    Skip specifies that the validation rules of this field should not be
    evaluated
    """

    required: bool = betterproto.bool_field(2)
    """Required specifies that this field must be set"""

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var required : bool

Required specifies that this field must be set

var skip : bool

Skip specifies that the validation rules of this field should not be evaluated

class RepeatedRules (min_items: int = <object object>, max_items: int = <object object>, unique: bool = <object object>, items: FieldRules = <object object>, ignore_empty: bool = <object object>)

RepeatedRules describe the constraints applied to repeated values

Expand source code
@dataclass(eq=False, repr=False)
class RepeatedRules(betterproto.Message):
    """RepeatedRules describe the constraints applied to `repeated` values"""

    min_items: int = betterproto.uint64_field(1)
    """
    MinItems specifies that this field must have the specified number of items
    at a minimum
    """

    max_items: int = betterproto.uint64_field(2)
    """
    MaxItems specifies that this field must have the specified number of items
    at a maximum
    """

    unique: bool = betterproto.bool_field(3)
    """
    Unique specifies that all elements in this field must be unique. This
    contraint is only applicable to scalar and enum types (messages are not
    supported).
    """

    items: "FieldRules" = betterproto.message_field(4)
    """
    Items specifies the contraints to be applied to each item in the field.
    Repeated message fields will still execute validation against each item
    unless skip is specified here.
    """

    ignore_empty: bool = betterproto.bool_field(5)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var itemsFieldRules

Items specifies the contraints to be applied to each item in the field. Repeated message fields will still execute validation against each item unless skip is specified here.

var max_items : int

MaxItems specifies that this field must have the specified number of items at a maximum

var min_items : int

MinItems specifies that this field must have the specified number of items at a minimum

var unique : bool

Unique specifies that all elements in this field must be unique. This contraint is only applicable to scalar and enum types (messages are not supported).

class SFixed32Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

SFixed32Rules describes the constraints applied to sfixed32 values

Expand source code
@dataclass(eq=False, repr=False)
class SFixed32Rules(betterproto.Message):
    """SFixed32Rules describes the constraints applied to `sfixed32` values"""

    const: int = betterproto.sfixed32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sfixed32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sfixed32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sfixed32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sfixed32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sfixed32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sfixed32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class SFixed64Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

SFixed64Rules describes the constraints applied to sfixed64 values

Expand source code
@dataclass(eq=False, repr=False)
class SFixed64Rules(betterproto.Message):
    """SFixed64Rules describes the constraints applied to `sfixed64` values"""

    const: int = betterproto.sfixed64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sfixed64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sfixed64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sfixed64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sfixed64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sfixed64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sfixed64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class SInt32Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

SInt32Rules describes the constraints applied to sint32 values

Expand source code
@dataclass(eq=False, repr=False)
class SInt32Rules(betterproto.Message):
    """SInt32Rules describes the constraints applied to `sint32` values"""

    const: int = betterproto.sint32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sint32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sint32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sint32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sint32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sint32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sint32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class SInt64Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

SInt64Rules describes the constraints applied to sint64 values

Expand source code
@dataclass(eq=False, repr=False)
class SInt64Rules(betterproto.Message):
    """SInt64Rules describes the constraints applied to `sint64` values"""

    const: int = betterproto.sint64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.sint64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.sint64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.sint64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.sint64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.sint64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.sint64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class StringRules (const: str = <object object>, len: int = <object object>, min_len: int = <object object>, max_len: int = <object object>, len_bytes: int = <object object>, min_bytes: int = <object object>, max_bytes: int = <object object>, pattern: str = <object object>, prefix: str = <object object>, suffix: str = <object object>, contains: str = <object object>, not_contains: str = <object object>, in_: List[str] = <object object>, not_in: List[str] = <object object>, email: bool = <object object>, hostname: bool = <object object>, ip: bool = <object object>, ipv4: bool = <object object>, ipv6: bool = <object object>, uri: bool = <object object>, uri_ref: bool = <object object>, address: bool = <object object>, uuid: bool = <object object>, well_known_regex: KnownRegex = <object object>, strict: bool = <object object>, ignore_empty: bool = <object object>)

StringRules describe the constraints applied to string values

Expand source code
@dataclass(eq=False, repr=False)
class StringRules(betterproto.Message):
    """StringRules describe the constraints applied to `string` values"""

    const: str = betterproto.string_field(1)
    """Const specifies that this field must be exactly the specified value"""

    len: int = betterproto.uint64_field(19)
    """
    Len specifies that this field must be the specified number of characters
    (Unicode code points). Note that the number of characters may differ from
    the number of bytes in the string.
    """

    min_len: int = betterproto.uint64_field(2)
    """
    MinLen specifies that this field must be the specified number of characters
    (Unicode code points) at a minimum. Note that the number of characters may
    differ from the number of bytes in the string.
    """

    max_len: int = betterproto.uint64_field(3)
    """
    MaxLen specifies that this field must be the specified number of characters
    (Unicode code points) at a maximum. Note that the number of characters may
    differ from the number of bytes in the string.
    """

    len_bytes: int = betterproto.uint64_field(20)
    """
    LenBytes specifies that this field must be the specified number of bytes at
    a minimum
    """

    min_bytes: int = betterproto.uint64_field(4)
    """
    MinBytes specifies that this field must be the specified number of bytes at
    a minimum
    """

    max_bytes: int = betterproto.uint64_field(5)
    """
    MaxBytes specifies that this field must be the specified number of bytes at
    a maximum
    """

    pattern: str = betterproto.string_field(6)
    """
    Pattern specifes that this field must match against the specified regular
    expression (RE2 syntax). The included expression should elide any
    delimiters.
    """

    prefix: str = betterproto.string_field(7)
    """
    Prefix specifies that this field must have the specified substring at the
    beginning of the string.
    """

    suffix: str = betterproto.string_field(8)
    """
    Suffix specifies that this field must have the specified substring at the
    end of the string.
    """

    contains: str = betterproto.string_field(9)
    """
    Contains specifies that this field must have the specified substring
    anywhere in the string.
    """

    not_contains: str = betterproto.string_field(23)
    """
    NotContains specifies that this field cannot have the specified substring
    anywhere in the string.
    """

    in_: List[str] = betterproto.string_field(10)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[str] = betterproto.string_field(11)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    email: bool = betterproto.bool_field(12, group="well_known")
    """
    Email specifies that the field must be a valid email address as defined by
    RFC 5322
    """

    hostname: bool = betterproto.bool_field(13, group="well_known")
    """
    Hostname specifies that the field must be a valid hostname as defined by
    RFC 1034. This constraint does not support internationalized domain names
    (IDNs).
    """

    ip: bool = betterproto.bool_field(14, group="well_known")
    """
    Ip specifies that the field must be a valid IP (v4 or v6) address. Valid
    IPv6 addresses should not include surrounding square brackets.
    """

    ipv4: bool = betterproto.bool_field(15, group="well_known")
    """Ipv4 specifies that the field must be a valid IPv4 address."""

    ipv6: bool = betterproto.bool_field(16, group="well_known")
    """
    Ipv6 specifies that the field must be a valid IPv6 address. Valid IPv6
    addresses should not include surrounding square brackets.
    """

    uri: bool = betterproto.bool_field(17, group="well_known")
    """
    Uri specifies that the field must be a valid, absolute URI as defined by
    RFC 3986
    """

    uri_ref: bool = betterproto.bool_field(18, group="well_known")
    """
    UriRef specifies that the field must be a valid URI as defined by RFC 3986
    and may be relative or absolute.
    """

    address: bool = betterproto.bool_field(21, group="well_known")
    """
    Address specifies that the field must be either a valid hostname as defined
    by RFC 1034 (which does not support internationalized domain names or
    IDNs), or it can be a valid IP (v4 or v6).
    """

    uuid: bool = betterproto.bool_field(22, group="well_known")
    """
    Uuid specifies that the field must be a valid UUID as defined by RFC 4122
    """

    well_known_regex: "KnownRegex" = betterproto.enum_field(24, group="well_known")
    """
    WellKnownRegex specifies a common well known pattern defined as a regex.
    """

    strict: bool = betterproto.bool_field(25)
    """
    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 a looser
    validations that only disallows \r\n\0 characters, which can be used to
    bypass header matching rules.
    """

    ignore_empty: bool = betterproto.bool_field(26)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var address : bool

Address specifies that the field must be either a valid hostname as defined by RFC 1034 (which does not support internationalized domain names or IDNs), or it can be a valid IP (v4 or v6).

var const : str

Const specifies that this field must be exactly the specified value

var contains : str

Contains specifies that this field must have the specified substring anywhere in the string.

var email : bool

Email specifies that the field must be a valid email address as defined by RFC 5322

var hostname : bool

Hostname specifies that the field must be a valid hostname as defined by RFC 1034. This constraint does not support internationalized domain names (IDNs).

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[str]

In specifies that this field must be equal to one of the specified values

var ip : bool

Ip specifies that the field must be a valid IP (v4 or v6) address. Valid IPv6 addresses should not include surrounding square brackets.

var ipv4 : bool

Ipv4 specifies that the field must be a valid IPv4 address.

var ipv6 : bool

Ipv6 specifies that the field must be a valid IPv6 address. Valid IPv6 addresses should not include surrounding square brackets.

var len : int

Len specifies that this field must be the specified number of characters (Unicode code points). Note that the number of characters may differ from the number of bytes in the string.

var len_bytes : int

LenBytes specifies that this field must be the specified number of bytes at a minimum

var max_bytes : int

MaxBytes specifies that this field must be the specified number of bytes at a maximum

var max_len : int

MaxLen specifies that this field must be the specified number of characters (Unicode code points) at a maximum. Note that the number of characters may differ from the number of bytes in the string.

var min_bytes : int

MinBytes specifies that this field must be the specified number of bytes at a minimum

var min_len : int

MinLen specifies that this field must be the specified number of characters (Unicode code points) at a minimum. Note that the number of characters may differ from the number of bytes in the string.

var not_contains : str

NotContains specifies that this field cannot have the specified substring anywhere in the string.

var not_in : List[str]

NotIn specifies that this field cannot be equal to one of the specified values

var pattern : str

Pattern specifes that this field must match against the specified regular expression (RE2 syntax). The included expression should elide any delimiters.

var prefix : str

Prefix specifies that this field must have the specified substring at the beginning of the string.

var strict : bool

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 a looser validations that only disallows characters, which can be used to bypass header matching rules.

var suffix : str

Suffix specifies that this field must have the specified substring at the end of the string.

var uri : bool

Uri specifies that the field must be a valid, absolute URI as defined by RFC 3986

var uri_ref : bool

UriRef specifies that the field must be a valid URI as defined by RFC 3986 and may be relative or absolute.

var uuid : bool

Uuid specifies that the field must be a valid UUID as defined by RFC 4122

var well_known_regexKnownRegex

WellKnownRegex specifies a common well known pattern defined as a regex.

class TimestampRules (required: bool = <object object>, const: datetime.datetime = <object object>, lt: datetime.datetime = <object object>, lte: datetime.datetime = <object object>, gt: datetime.datetime = <object object>, gte: datetime.datetime = <object object>, lt_now: bool = <object object>, gt_now: bool = <object object>, within: datetime.timedelta = <object object>)

TimestampRules describe the constraints applied exclusively to the google.protobuf.Timestamp well-known type

Expand source code
@dataclass(eq=False, repr=False)
class TimestampRules(betterproto.Message):
    """
    TimestampRules describe the constraints applied exclusively to the
    `google.protobuf.Timestamp` well-known type
    """

    required: bool = betterproto.bool_field(1)
    """Required specifies that this field must be set"""

    const: datetime = betterproto.message_field(2)
    """Const specifies that this field must be exactly the specified value"""

    lt: datetime = betterproto.message_field(3)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: datetime = betterproto.message_field(4)
    """
    Lte specifies that this field must be less than the specified value,
    inclusive
    """

    gt: datetime = betterproto.message_field(5)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive
    """

    gte: datetime = betterproto.message_field(6)
    """
    Gte specifies that this field must be greater than the specified value,
    inclusive
    """

    lt_now: bool = betterproto.bool_field(7)
    """
    LtNow specifies that this must be less than the current time. LtNow can
    only be used with the Within rule.
    """

    gt_now: bool = betterproto.bool_field(8)
    """
    GtNow specifies that this must be greater than the current time. GtNow can
    only be used with the Within rule.
    """

    within: timedelta = betterproto.message_field(9)
    """
    Within specifies that this field must be within this duration of the
    current time. This constraint can be used alone or with the LtNow and GtNow
    rules.
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : datetime.datetime

Const specifies that this field must be exactly the specified value

var gt : datetime.datetime

Gt specifies that this field must be greater than the specified value, exclusive

var gt_now : bool

GtNow specifies that this must be greater than the current time. GtNow can only be used with the Within rule.

var gte : datetime.datetime

Gte specifies that this field must be greater than the specified value, inclusive

var lt : datetime.datetime

Lt specifies that this field must be less than the specified value, exclusive

var lt_now : bool

LtNow specifies that this must be less than the current time. LtNow can only be used with the Within rule.

var lte : datetime.datetime

Lte specifies that this field must be less than the specified value, inclusive

var required : bool

Required specifies that this field must be set

var within : datetime.timedelta

Within specifies that this field must be within this duration of the current time. This constraint can be used alone or with the LtNow and GtNow rules.

class UInt32Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

UInt32Rules describes the constraints applied to uint32 values

Expand source code
@dataclass(eq=False, repr=False)
class UInt32Rules(betterproto.Message):
    """UInt32Rules describes the constraints applied to `uint32` values"""

    const: int = betterproto.uint32_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.uint32_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.uint32_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.uint32_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.uint32_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.uint32_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.uint32_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values

class UInt64Rules (const: int = <object object>, lt: int = <object object>, lte: int = <object object>, gt: int = <object object>, gte: int = <object object>, in_: List[int] = <object object>, not_in: List[int] = <object object>, ignore_empty: bool = <object object>)

UInt64Rules describes the constraints applied to uint64 values

Expand source code
@dataclass(eq=False, repr=False)
class UInt64Rules(betterproto.Message):
    """UInt64Rules describes the constraints applied to `uint64` values"""

    const: int = betterproto.uint64_field(1)
    """Const specifies that this field must be exactly the specified value"""

    lt: int = betterproto.uint64_field(2)
    """
    Lt specifies that this field must be less than the specified value,
    exclusive
    """

    lte: int = betterproto.uint64_field(3)
    """
    Lte specifies that this field must be less than or equal to the specified
    value, inclusive
    """

    gt: int = betterproto.uint64_field(4)
    """
    Gt specifies that this field must be greater than the specified value,
    exclusive. If the value of Gt is larger than a specified Lt or Lte, the
    range is reversed.
    """

    gte: int = betterproto.uint64_field(5)
    """
    Gte specifies that this field must be greater than or equal to the
    specified value, inclusive. If the value of Gte is larger than a specified
    Lt or Lte, the range is reversed.
    """

    in_: List[int] = betterproto.uint64_field(6)
    """
    In specifies that this field must be equal to one of the specified values
    """

    not_in: List[int] = betterproto.uint64_field(7)
    """
    NotIn specifies that this field cannot be equal to one of the specified
    values
    """

    ignore_empty: bool = betterproto.bool_field(8)
    """
    IgnoreEmpty specifies that the validation rules of this field should be
    evaluated only if the field is not empty
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var const : int

Const specifies that this field must be exactly the specified value

var gt : int

Gt specifies that this field must be greater than the specified value, exclusive. If the value of Gt is larger than a specified Lt or Lte, the range is reversed.

var gte : int

Gte specifies that this field must be greater than or equal to the specified value, inclusive. If the value of Gte is larger than a specified Lt or Lte, the range is reversed.

var ignore_empty : bool

IgnoreEmpty specifies that the validation rules of this field should be evaluated only if the field is not empty

var in_ : List[int]

In specifies that this field must be equal to one of the specified values

var lt : int

Lt specifies that this field must be less than the specified value, exclusive

var lte : int

Lte specifies that this field must be less than or equal to the specified value, inclusive

var not_in : List[int]

NotIn specifies that this field cannot be equal to one of the specified values