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

core.ConstraintsProperties(
    self,
    required=None,
    unique=None,
    pattern=None,
    enum=None,
    min_length=None,
    max_length=None,
    minimum=None,
    maximum=None,
    exclusive_minimum=None,
    exclusive_maximum=None,
    json_schema=None,
)

A class that expresses constraints for validating field values.

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 an instance with default values.

default

core.ConstraintsProperties.default()

Creates an instance with default values.

Returns

: Self

A ConstraintsProperties object with default values