Structural and Domain Validation of Data
Structural validation checks that a record has the intended fields and types. Domain validation checks the rule those values are meant to obey.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace two failures
A stored schedule with text in the duration field fails its type check. A record with numeric duration minus five passes that type check but can still violate a nonnegative-duration rule. Parsing and domain validation describe a similar two-stage boundary.
Show what to repair
Report the field and expected shape for structural failures. Report the business limit with its unit for a domain failure. Use unit-aware names so “five” has an agreed interpretation.[1]
Trace a structurally valid but impossible reservation
An object has integer start=17 and end=12. Both fields satisfy their individual type checks. A reservation rule requiring start earlier than end rejects the combination. Check units and timeline representation before doing the comparison. See intervals as pairs.
Missing end → structural failure
End recorded as "noon" when integer required → type failure
Both integers with end before start → domain failure
Put context where it can see related values
Some constraints depend on input outside the record, such as whether a room exists in the catalogue. Keep the parser's job distinct from checking live eligibility. Test model rules with valid structure so a syntax error cannot mask a domain defect.