Row
This class represents a structured data definition used for validation and schema generation, capturing field types, input sources, and validation constraints. It provides properties to format type information and input sources into human-readable strings for documentation or reporting. Additionally, it supports the inclusion of validation examples and core schema references to define data integrity rules.
Attributes
| Attribute | Type | Description |
|---|---|---|
| field_type | `type[Any] | str` |
| input_type | `type[Any] | str` |
| python_input | bool = False | Flag indicating if the row supports input data originating from Python objects. |
| json_input | bool = False | Flag indicating if the row supports input data originating from JSON strings. |
| strict | bool = False | Determines whether validation should strictly enforce types without attempting coercion. |
| condition | `str | None` = None |
| valid_examples | `list[Any] | None` = None |
| invalid_examples | `list[Any] | None` = None |
| core_schemas | `list[type[CoreSchema]] | None` = None |
Methods
field_type_str()
@classmethod
def field_type_str() - > string
Returns the string representation of the field type, using the type's name if available or the raw value otherwise.
Returns
| Type | Description |
|---|---|
string | The name of the field type or its string representation for display purposes. |
input_type_str()
@classmethod
def input_type_str() - > string
Returns the string representation of the input type, using the type's name if available or the raw value otherwise.
Returns
| Type | Description |
|---|---|
string | The name of the input type or its string representation for display purposes. |
input_source_str()
@classmethod
def input_source_str() - > string
Determines the human-readable source of the input data based on whether Python or JSON inputs are enabled.
Returns
| Type | Description |
|---|---|
string | A string indicating the source, such as 'Python', 'JSON', 'Python & JSON', or an empty string if neither is set. |