Reading a Small Data Schema Example
A useful schema example reveals field names, types, constraints, and the treatment of values that do not follow those expectations.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Compare two plausible readings
A measurement with station A and reading 7 may require an integer, a floating result, or a string label. A schema can declare a numeric value with a unit field. Typed input records explain how the reader reaches those values.
Explore an absent optional field
Try the same measurement with no note and with a null note. Those samples expose whether callers need their difference. Required and optional fields define the surrounding contract.[1]
Turn one field constraint into adjacent test cases
Suppose a small schema requires an integer count from zero through nine and a nonempty string label. Test counts zero and nine as accepted boundaries, then ten and minus one as rejections. The string "9" can fail the integer type check even though it is parseable by another layer. See required versus optional fields.
count 0, label A → valid
count 9, label A → valid
count 10, label A → range error
count "9", label A → type error
Include cross-field rules if the schema language supports them
A model can require a label only for positive count. Test counts zero and one with the label omitted to inspect that dependency. Keep the expected outcome attached to the precise input.