buffalo_core.SchemaField
- class buffalo_core.SchemaField(value_kind, required, label, order, short_help, default=None, choices=None, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, tuple_length=None, min_items=None, max_items=None, item_kind=None, format_hint=None, reference_target=None, collection_add_label=None, collection_item_label_field=None, collection_item_creation_hint=None, collection_key_label=None, collection_key_format_hint=None, notes=None, advanced=False, shown_when=None, enabled_when=None, required_when=None)[source]
Bases:
objectStructured machine-readable metadata for one dataclass field.
Notes
This dataclass is a builder for the plain dictionary stored in
dataclasses.field(metadata=...). Downstream projects keep their dataclasses as the source of truth while still attaching stable GUI and editor hints in one shared Core format.Methods
Return the plain metadata mapping stored in dataclass fields.
Attributes
Machine-readable category such as
enum,number, orlist.Whether the field is required by the schema contract.
Human-readable field label for UIs and editors.
Suggested stable display ordering for sibling fields.
Short help text describing the field for direct UI display.
Optional default value when one is meaningful for editing.
Optional enum-like choices exposed as structured value/label pairs.
Inclusive numeric lower bound when one is known.
Inclusive numeric upper bound when one is known.
Exclusive numeric lower bound when one is known.
Exclusive numeric upper bound when one is known.
Expected tuple length when the field stores a fixed-size tuple.
Minimum item count when the field stores a collection.
Maximum item count when the field stores a collection.
Machine-readable description of collection item shape or type.
Optional formatting hint for text or tuple entry widgets.
Optional logical target when the field references named objects.
Optional add-item button label for collection editors.
Optional item field used as the row label in collection editors.
Optional help text for creating new collection items.
Optional label used for mapping keys in collection editors.
Optional format hint used for mapping keys in collection editors.
Optional extra machine-usable clarification text.
Whether the field should default to an advanced editing section.
Optional conditions controlling whether a field should be shown.
Optional conditions controlling whether a field should be editable.
Optional conditions controlling whether a field becomes required.
- value_kind: str
Machine-readable category such as
enum,number, orlist.
- required: bool
Whether the field is required by the schema contract.
- label: str
Human-readable field label for UIs and editors.
- order: int
Suggested stable display ordering for sibling fields.
- short_help: str
Short help text describing the field for direct UI display.
- default: object | None
Optional default value when one is meaningful for editing.
- choices: tuple[SchemaChoice | object, ...] | None
Optional enum-like choices exposed as structured value/label pairs.
- minimum: float | int | None
Inclusive numeric lower bound when one is known.
- maximum: float | int | None
Inclusive numeric upper bound when one is known.
- exclusive_minimum: float | int | None
Exclusive numeric lower bound when one is known.
- exclusive_maximum: float | int | None
Exclusive numeric upper bound when one is known.
- tuple_length: int | None
Expected tuple length when the field stores a fixed-size tuple.
- min_items: int | None
Minimum item count when the field stores a collection.
- max_items: int | None
Maximum item count when the field stores a collection.
- item_kind: str | None
Machine-readable description of collection item shape or type.
- format_hint: str | None
Optional formatting hint for text or tuple entry widgets.
- reference_target: str | None
Optional logical target when the field references named objects.
- collection_add_label: str | None
Optional add-item button label for collection editors.
- collection_item_label_field: str | None
Optional item field used as the row label in collection editors.
- collection_item_creation_hint: str | None
Optional help text for creating new collection items.
- collection_key_label: str | None
Optional label used for mapping keys in collection editors.
- collection_key_format_hint: str | None
Optional format hint used for mapping keys in collection editors.
- notes: str | None
Optional extra machine-usable clarification text.
- advanced: bool
Whether the field should default to an advanced editing section.
- shown_when: tuple[SchemaCondition, ...] | None
Optional conditions controlling whether a field should be shown.
- enabled_when: tuple[SchemaCondition, ...] | None
Optional conditions controlling whether a field should be editable.
- required_when: tuple[SchemaCondition, ...] | None
Optional conditions controlling whether a field becomes required.