Skip to main content
Pydantic Docs

Search documentation

Type to search this documentation.

On this pageOverview

Aliases

Support for alias configurations.

A data class used by validation_alias as a convenience to create aliases.

A list of string or integer aliases.

Type: list[int | str]

Python
def convert_to_aliases() -> list[str | int]

Converts arguments to a list of string or integer aliases.

list[str | int] — The list of aliases.

Python
def search_dict_for_path(d: dict) -> Any

Searches a dictionary for the path specified by the alias.

Any — The value at the specified path, or PydanticUndefined if the path is not found.

A data class used by validation_alias as a convenience to create aliases.

A list containing a string or AliasPath.

Type: list[str | AliasPath]

Python
def convert_to_aliases() -> list[list[str | int]]

Converts arguments to a list of lists containing string or integer aliases.

list[list[str | int]] — The list of aliases.

A data class used by alias_generator as a convenience to create various aliases.

A callable that takes a field name and returns an alias for it.

Type: Callable[[str], str] | None

A callable that takes a field name and returns a validation alias for it.

Type: Callable[[str], str | AliasPath | AliasChoices] | None

A callable that takes a field name and returns a serialization alias for it.

Type: Callable[[str], str] | None

Python
def generate_aliases(
    field_name: str,
) -> tuple[str | None, str | AliasPath | AliasChoices | None, str | None]

Generate alias, validation_alias, and serialization_alias for a field.

tuple[str | None, str | AliasPath | AliasChoices | None, str | None] — A tuple of three aliases - validation, alias, and serialization.

Was this page helpful?

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu