IdDisplayFormat

class emmet.core.types.typing.IdDisplayFormat(formatter)

Bases: object

Annotated metadata marking a field as holding an MP identifier.

Pydantic ignores unknown Annotated metadata, so this has no effect on validation or serialization. It lets consumers (e.g. the API’s id_format query parameter) discover which fields of a model hold identifiers, and how to render them, by inspecting the model’s type annotations.

Attributes:
formatter: Callable formatter(value, legacy=<bool>) which renders the

identifier in either the legacy or AlphaID display form.

Parameters:

formatter (Callable[[...], Any])