buffalo_core.schema.SchemaChoice
- class buffalo_core.schema.SchemaChoice(value, label)[source]
Bases:
objectStructured choice metadata for one enum-like schema value.
Notes
valueremains the serialized schema token.labelprovides 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.
Return the plain metadata mapping stored in dataclass fields.
Attributes
Serialized schema value for one choice.
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 fromvalue.
- Returns:
Structured choice metadata carrying both the serialized value and a display-friendly label.
- Return type: