AliasPath
A data class used by validation_alias as a convenience to create aliases.
Attributes
| Attribute | Type | Description |
|---|---|---|
| path | `list[int | str]` |
Constructor
Signature
def AliasPath(
first_arg: str,
*args: str | int
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| first_arg | str | The first element of the alias path. |
| *args | `str | int` |
Signature
def AliasPath(
first_arg: str,
*args: str | int
)
Parameters
| Name | Type | Description |
|---|---|---|
| first_arg | str | The initial segment of the alias path, typically a dictionary key. |
| *args | `str | int` |
Methods
convert_to_aliases()
@classmethod
def convert_to_aliases() - > list[str | int]
Converts arguments to a list of string or integer aliases.
Returns
| Type | Description |
|---|---|
| `list[str | int]` |
search_dict_for_path()
@classmethod
def search_dict_for_path(
d: dict
) - > Any
Searches a dictionary for the path specified by the alias.
Parameters
| Name | Type | Description |
|---|---|---|
| d | dict | The source dictionary to traverse using the defined alias path segments. |
Returns
| Type | Description |
|---|---|
Any | The value at the specified path, or PydanticUndefined if the path is not found. |