Schema Data Types
The Internet Object schema type system — base types, shortcuts, and TypeDefs.
A schema constrains each member to a type. The type system is small by design: a handful of base types, plus a closed set of shortcuts — names that stand for a base type with preset constraints baked in. Every type is configured through its TypeDef, the fixed set of options it accepts.
Base types
A member written without a type defaults to any, so name, age declares two any members.
date,time, anddatetimeare their own types, not subtypes ofstring. Earlier drafts described them as string-derived; they are temporal types with their own literal values. See Date and Time.
Shortcuts
A shortcut is a built-in name equal to a base type plus preset constraints. It is not a new type — it is a convenient, validated configuration of a base type. A conformant validator MUST recognize every shortcut name.
string
email, url
string with a built-in pattern
number
int, uint, int8, int16, int32, uint8 (byte), uint16, uint32
number restricted to whole values in a fixed range
See Numeric Types for the full numeric family and ranges, and String Types for email and url.
Reserved.
int64,uint64,float32, andfloat64are reserved for future use and are not yet validated by the reference implementation.
TypeDef and MemberDef
Each type defines a TypeDef — the exact set of options it accepts (for example, string accepts pattern, minLen, maxLen; number accepts min, max, multipleOf). Supplying a type together with chosen options produces a MemberDef, the definition of a single member:
The first value in a MemberDef is the type; the second is the default; the third is choices. Remaining options are written as key: value pairs. An option a type does not define is rejected. Each type page lists its TypeDef in full.
See Also
Last updated
Was this helpful?
