ConstraintsProperties

Warning

🚧 Sprout is still in active development and evolving quickly, so the documentation and functionality may not work as described and could undergo substantial changes 🚧

core.ConstraintsProperties(
    self,
    required: bool | None = None,
    unique: bool | None = None,
    pattern: str | None = None,
    enum: list | None = None,
    min_length: int | None = None,
    max_length: int | None = None,
    minimum: str | float | int | None = None,
    maximum: str | float | int | None = None,
    exclusive_minimum: str | float | int | None = None,
    exclusive_maximum: str | float | int | None = None,
    json_schema: dict[str, Any] | None = None,
)

A dataclass that expresses constraints for validating field values.

A constraint is a rule that dictates the given values, or range of values, that a variable or column can have in a dataset. For instance, a constraint for an “age” column could be that it must be greater than 0 but less than 120.

Attributes

required : bool | None

Indicates whether a property must have a value for each instance.

unique : bool | None

When true, each value for the property must be unique.

pattern : str | None

A regular expression pattern to test each value of the property against, where a truthy response indicates validity.

enum : list | None

The value of the field must exactly match one of the values in the enum array.

min_length : int | None

An integer that specifies the minimum length of a value.

max_length : int | None

An integer that specifies the maximum length of a value.

minimum : str | float | int | None

Specifies a minimum value for a field.

maximum : str | float | int | None

Specifies a maximum value for a field.

exclusive_minimum : str | float | int | None

Specifies an exclusive minimum value for a field.

exclusive_maximum : str | float | int | None

Specifies an exclusive maximum value for a field.

json_schema : dict[str, Any] | None

A valid JSON schema object to validate field values. If a field value conforms to the provided JSON schema then this field value is valid.

Methods

Name Description
default Creates a ConstraintsProperties dataclass with default values.

default

core.ConstraintsProperties.default()

Creates a ConstraintsProperties dataclass with default values.

Returns

Self

A ConstraintsProperties dataclass with default values.