ValidationAlias
This class represents a flexible mechanism for defining validation aliases, supporting single string keys, structured lookup paths, or multiple alternative alias choices. It enables the mapping of input data fields to internal model attributes using various path-based or choice-based strategies.
Attributes
| Attribute | Type | Description |
|---|---|---|
| Str | str | A single string representing the direct key used to look up data in the input source. |
| AliasPath | `list[int | str]` |
| AliasChoices | `list[list[int | str]]` |
Constructor
Signature
def Str(
value: PyBackedStr
) - > [ValidationAlias](validationalias.md?sid=lookup_key_validationalias)
Parameters
| Name | Type | Description |
|---|---|---|
| value | PyBackedStr | The string value to be used as the validation alias. |
Signature
def AliasPath(
path: [LookupPath](lookuppath.md?sid=lookup_key_lookuppath)
) - > [ValidationAlias](validationalias.md?sid=lookup_key_validationalias)
Parameters
| Name | Type | Description |
|---|---|---|
| path | [LookupPath](lookuppath.md?sid=lookup_key_lookuppath) | A list of integers or strings defining the sequence of keys or indices to traverse. |
Signature
def AliasChoices(
choices: SmallVec< [LookupPath; 1] >
) - > [ValidationAlias](validationalias.md?sid=lookup_key_validationalias)
Parameters
| Name | Type | Description |
|---|---|---|
| choices | SmallVec< [LookupPath; 1] > | A collection of lookup paths, where each path is a list of integers or strings. |