buffalo_core.SchemaChoice

class buffalo_core.SchemaChoice(value, label)[source]

Bases: object

Structured choice metadata for one enum-like schema value.

Notes

value remains the serialized schema token. label provides the human-readable text that GUIs or editors can display without changing the underlying serialized contract.

Methods

from_value(value, *[, label])

Build one choice from a serialized value.

to_metadata()

Return the plain metadata mapping stored in dataclass fields.

Attributes

value

Serialized schema value for one choice.

label

Human-readable label for presenting the choice in a UI.

value: object

Serialized schema value for one choice.

label: str

Human-readable label for presenting the choice in a UI.

classmethod from_value(value, *, label=None)[source]

Build one choice from a serialized value.

Parameters:
  • value (object) – Serialized schema value to preserve in metadata.

  • label (str | None, optional) – Optional explicit display label. When omitted, a generic display label is derived from value.

Returns:

Structured choice metadata carrying both the serialized value and a display-friendly label.

Return type:

SchemaChoice

to_metadata()[source]

Return the plain metadata mapping stored in dataclass fields.

Return type:

SchemaFieldMetadata