Teek::UI::Validator Class
Walks a Document before realize and collects ALL problems, so a
broken build can be fixed in one pass instead of a cycle of “run, hit
the next cryptic Tcl error, fix, repeat.” Headless - no interpreter
needed, since it only ever inspects the tree.
Two severities: problems that are “definitely broken” raise (folded
into one ValidationError listing every one found); problems that
are “probably a mistake” warn via Kernel#warn by default, or raise
too under strict: true.
This class runs the checks that span the whole tree or relate
arbitrary nodes to each other (dangling event targets, orphans). A
specific widget/container’s own contract (a grid’s children all need
cells, a tab’s parent must be a ui.tabs, …) lives in its own
WidgetValidators-registered validator instead (see
GridValidator/TabValidator/PaneValidator/OverlayValidator), dispatched by node
type the same way Teek::CommandInterceptors dispatches by widget
type. One depth-first walk covers both the document-level checks
below and every registered widget validator.
A WidgetType descriptor’s own validator: (see WidgetTypes)
needs no separate handling here at all - WidgetTypes.register
forwards it into WidgetValidators directly, so it’s dispatched
through the exact same WidgetValidators.for_type call every other
validator already goes through.
Inherits: Object
Class Methods ↑
validate!(document, strict: false)
Parameters
documentDocumentstrictBoolean— promote warn-level problems (currently just orphans) to raise-level too
@raise ValidationError