Composing Small Validators
Validators can check different conditions on one input and combine results under a rule for error collection or early exit.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace two failures
A field may be both empty and outside a set of allowed labels. The UI can prefer the missing-field reason or collect all relevant reasons. Structured decisions make the difference observable.
Respect prerequisite checks
A numeric-range validator should receive a parsed numeric value. If parsing failed, later comparison may be meaningless. Structural and domain validation define useful stages for composition.[1]